diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-11-19 00:33:08 +0100 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-11-19 00:33:08 +0100 |
commit | 1d922d0ce92a95437616a3793c6068b51ec72a5d (patch) | |
tree | 22bee847c70705389a818e54e5e6718b0b70daba | |
parent | 28c295f4cca53806e06afec9706be88d5b3e05c3 (diff) | |
parent | db118f5db7ee8b52faf2c0bb32ed41e774609032 (diff) | |
download | cpython-git-1d922d0ce92a95437616a3793c6068b51ec72a5d.tar.gz |
Close #22370: Windows detection in pathlib is now more robust.
-rw-r--r-- | Lib/pathlib.py | 9 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index bceae00751..1622cbb92f 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -15,16 +15,15 @@ from urllib.parse import quote_from_bytes as urlquote_from_bytes supports_symlinks = True -try: +if os.name == 'nt': import nt -except ImportError: - nt = None -else: if sys.getwindowsversion()[:2] >= (6, 0): from nt import _getfinalpathname else: supports_symlinks = False _getfinalpathname = None +else: + nt = None __all__ = [ @@ -110,7 +109,7 @@ class _WindowsFlavour(_Flavour): has_drv = True pathmod = ntpath - is_supported = (nt is not None) + is_supported = (os.name == 'nt') drive_letters = ( set(chr(x) for x in range(ord('a'), ord('z') + 1)) | @@ -185,6 +185,8 @@ Core and Builtins Library ------- +- Issue #22370: Windows detection in pathlib is now more robust. + - Issue #22841: Reject coroutines in asyncio add_signal_handler(). Patch by Ludovic.Gasc. |