[issue22370] pathlib OS detection
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - pitrou nosy: +pitrou, serhiy.storchaka type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
Antoine Pitrou added the comment: This sounds reasonable, indeed. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
Roundup Robot added the comment: New changeset cb1d7eac601d by Antoine Pitrou in branch '3.4': Close #22370: Windows detection in pathlib is now more robust. https://hg.python.org/cpython/rev/cb1d7eac601d New changeset 712f246da49b by Antoine Pitrou in branch 'default': Close #22370: Windows detection in pathlib is now more robust. https://hg.python.org/cpython/rev/712f246da49b -- nosy: +python-dev resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
New submission from Antony Lee: Currently, pathlib contains the following check for the OS in the import section: try: import nt except ImportError: nt = None else: if sys.getwindowsversion()[:2] = (6, 0): from nt import _getfinalpathname else: supports_symlinks = False _getfinalpathname = None I would like to suggest to switch this on testing for the value of `os.name` (as `PurePath.__new__` does), or possibly testing whether `sys.getwindowsversion` exists: the `nt` module is not publicly defined, so it wouldn't be unreasonable to have a file named `nt.py` on an Unix system (where this shouldn't cause any problems), in which case importing `pathlib` raises an AttributeError at the `getwindowsversion` line. -- components: Library (Lib) messages: 226644 nosy: Antony.Lee priority: normal severity: normal status: open title: pathlib OS detection versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com