diff options
author | Steve Dower <steve.dower@python.org> | 2023-05-29 09:05:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 09:05:32 (GMT) |
commit | bfd20d257e4ad16a25f4bac0ea4dbb719cdf6bc7 (patch) | |
tree | 325056d3c4bbd55dd1b81be6d7ab150b5c0749b1 /Lib/ntpath.py | |
parent | e92ac0a741b125f1cffe8c07b054d1dea7b0a05a (diff) | |
download | cpython-bfd20d257e4ad16a25f4bac0ea4dbb719cdf6bc7.zip cpython-bfd20d257e4ad16a25f4bac0ea4dbb719cdf6bc7.tar.gz cpython-bfd20d257e4ad16a25f4bac0ea4dbb719cdf6bc7.tar.bz2 |
gh-104803: Implement ntpath.isdevdrive for checking whether a path is on a Windows Dev Drive (GH-104805)
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r-- | Lib/ntpath.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py index 0f3674f..dadcdc0 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -867,3 +867,19 @@ try: except ImportError: # Use genericpath.* as imported above pass + + +try: + from nt import _path_isdevdrive +except ImportError: + def isdevdrive(path): + """Determines whether the specified path is on a Windows Dev Drive.""" + # Never a Dev Drive + return False +else: + def isdevdrive(path): + """Determines whether the specified path is on a Windows Dev Drive.""" + try: + return _path_isdevdrive(abspath(path)) + except OSError: + return False |