mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
(cherry picked from commit d0c67ea064)
Co-authored-by: Dong-hee Na <donghee.na@python.org>
This commit is contained in:
parent
66cde7c51a
commit
1f2ec4cef1
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.
|
||||||
|
|
@ -847,14 +847,7 @@ oserror_parse_args(PyObject **p_args,
|
||||||
winerrcode = PyLong_AsLong(*winerror);
|
winerrcode = PyLong_AsLong(*winerror);
|
||||||
if (winerrcode == -1 && PyErr_Occurred())
|
if (winerrcode == -1 && PyErr_Occurred())
|
||||||
return -1;
|
return -1;
|
||||||
/* Set errno to the corresponding POSIX errno (overriding
|
errcode = winerror_to_errno(winerrcode);
|
||||||
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;
|
|
||||||
*myerrno = PyLong_FromLong(errcode);
|
*myerrno = PyLong_FromLong(errcode);
|
||||||
if (!*myerrno)
|
if (!*myerrno)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue