8000 bpo-46775: OSError should call winerror_to_errno unconditionally on W… · python/cpython@d0c67ea · GitHub
[go: up one dir, main page]

Skip to content

Commit d0c67ea

Browse files
authored
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
1 parent a03a09e commit d0c67ea

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Some Windows system error codes(>= 10000) are now mapped into
2+
the correct errno and may now raise a subclass of :exc:`OSError`.
3+
Patch by Dong-hee Na.

Objects/exceptions.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,14 +1634,7 @@ oserror_parse_args(PyObject **p_args,
16341634
winerrcode = PyLong_AsLong(*winerror);
16351635
if (winerrcode == -1 && PyErr_Occurred())
16361636
return -1;
1637-
/* Set errno to the corresponding POSIX errno (overriding
1638-
first argument). Windows Socket error codes (>= 10000)
1639-
have the same value as their POSIX counterparts.
1640-
*/
1641-
if (winerrcode < 10000)
1642-
errcode = winerror_to_errno(winerrcode);
1643-
else
1644-
errcode = winerrcode;
1637+
errcode = winerror_to_errno(winerrcode);
16451638
*myerrno = PyLong_FromLong(errcode);
16461639
if (!*myerrno)
16471640
return -1;

0 commit comments

Comments
 (0)
0