[issue38081] Different behavior of os.path.realpath('nul') in 3.7 and 3.8

Steve Dower report at bugs.python.org
Tue Sep 10 12:28:03 EDT 2019


Steve Dower <steve.dower at python.org> added the comment:

What does pip use it for?

Applying the below change avoids the exception, but produces \\.\nul as the result, which may or may not be any better.

diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 1d22d5f1dc..becfa20a83 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -537,7 +537,7 @@ else:
             except OSError as ex:
                 # Stop on file (2) or directory (3) not found, or
                 # paths that are not reparse points (4390)
-                if ex.winerror in (2, 3, 4390):
+                if ex.winerror in (1, 2, 3, 4390):
                     break
                 raise
             except ValueError:
@@ -555,7 +555,7 @@ else:

         # Allow file (2) or directory (3) not found, invalid syntax (123),
         # and symlinks that cannot be followed (1921)
-        allowed_winerror = 2, 3, 123, 1921
+        allowed_winerror = 2, 3, 87, 123, 1921

         # Non-strict algorithm is to find as much of the target directory
         # as we can and join the rest.

----------
assignee:  -> steve.dower

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38081>
_______________________________________


More information about the Python-bugs-list mailing list