Skip to content

Commit

Permalink
bpo-46775: OSError should call winerror_to_errno unconditionally on W…
Browse files Browse the repository at this point in the history
…indows (GH-32179)

(cherry picked from commit d0c67ea)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
  • Loading branch information
miss-islington and corona10 committed Mar 31, 2022
1 parent c26af2b commit d04a213
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
@@ -0,0 +1,3 @@
Some Windows system error codes(>= 10000) are now mapped into
the correct errno and may now raise a subclass of :exc:`OSError`.
Patch by Dong-hee Na.
9 changes: 1 addition & 8 deletions Objects/exceptions.c
Expand Up @@ -844,14 +844,7 @@ oserror_parse_args(PyObject **p_args,
winerrcode = PyLong_AsLong(*winerror);
if (winerrcode == -1 && PyErr_Occurred())
return -1;
/* Set errno to the corresponding POSIX errno (overriding
first argument). Windows Socket error codes (>= 10000)
have the same value as their POSIX counterparts.
*/
if (winerrcode < 10000)
errcode = winerror_to_errno(winerrcode);
else
errcode = winerrcode;
errcode = winerror_to_errno(winerrcode);
*myerrno = PyLong_FromLong(errcode);
if (!*myerrno)
return -1;
Expand Down

0 comments on commit d04a213

Please sign in to comment.