changeset: 93509:712f246da49b parent: 93507:902dbf99fc28 parent: 93508:cb1d7eac601d user: Antoine Pitrou date: Wed Nov 19 00:33:08 2014 +0100 files: Lib/pathlib.py Misc/NEWS description: Close #22370: Windows detection in pathlib is now more robust. diff -r 902dbf99fc28 -r 712f246da49b Lib/pathlib.py --- a/Lib/pathlib.py Wed Nov 19 00:13:24 2014 +0200 +++ b/Lib/pathlib.py Wed Nov 19 00:33:08 2014 +0100 @@ -15,16 +15,15 @@ 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 @@ 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)) | diff -r 902dbf99fc28 -r 712f246da49b Misc/NEWS --- a/Misc/NEWS Wed Nov 19 00:13:24 2014 +0200 +++ b/Misc/NEWS Wed Nov 19 00:33:08 2014 +0100 @@ -185,6 +185,8 @@ Library ------- +- Issue #22370: Windows detection in pathlib is now more robust. + - Issue #22841: Reject coroutines in asyncio add_signal_handler(). Patch by Ludovic.Gasc.