gh-107913: Fix possible losses of OSError error codes (GH-107930)
Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code.
This commit is contained in:
@@ -7101,7 +7101,7 @@ decode_code_page_errors(UINT code_page,
|
||||
if (err != ERROR_NO_UNICODE_TRANSLATION
|
||||
&& err != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
PyErr_SetFromWindowsErr(0);
|
||||
PyErr_SetFromWindowsErr(err);
|
||||
goto error;
|
||||
}
|
||||
insize++;
|
||||
|
||||
Reference in New Issue
Block a user