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

Eryk Sun report at bugs.python.org
Wed Sep 11 11:14:03 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

We should allow ERROR_INVALID_FUNCTION (1), ERROR_INVALID_PARAMETER (87), and ERROR_NOT_SUPPORTED (50) for readlink and _getfinalpathname, which can indicate a device that does not implement or is not mounted by a file system. We should also allow ERROR_BAD_NET_NAME (67, "the network name cannot be found"), which indicates that a server or share isn't found when opening a UNC path.

I don't know whether ERROR_INVALID_NAME (123) should be allowed. Also, it hasn't been added already, but I'd be equally unsure about adding ERROR_BAD_PATHNAME (161). These aren't like a missing file, path, or server, or an unsupported device. I know Python's realpath() is supposed to be permissive, but that's going too far I think.

Returning r"\\.\nul" is fine. I'd prefer to change os.devnull to match it. Scripts should be able to handle this since already abspath(os.devnull) is r"\\.\nul".

----------

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


More information about the Python-bugs-list mailing list