]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
authorDong-hee Na <donghee.na@python.org>
Wed, 30 Mar 2022 17:31:33 +0000 (02:31 +0900)
committerGitHub <noreply@github.com>
Wed, 30 Mar 2022 17:31:33 +0000 (18:31 +0100)
Misc/NEWS.d/next/Core and Builtins/2022-03-30-02-36-25.bpo-46775.e3Oxqf.rst [new file with mode: 0644]
Objects/exceptions.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-03-30-02-36-25.bpo-46775.e3Oxqf.rst b/Misc/NEWS.d/next/Core and Builtins/2022-03-30-02-36-25.bpo-46775.e3Oxqf.rst
new file mode 100644 (file)
index 0000000..da56ecd
--- /dev/null
@@ -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.
index 9dbbd40f1de1c4a8cbff144179d51d8554c637f1..df10a3c2416e3de7e31785bafdf09cec887a964b 100644 (file)
@@ -1634,14 +1634,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;