Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d0e9b69

Browse files
committed
Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
2 parents a55553d + 04d4229 commit d0e9b69

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lib/pathlib.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,3 +1425,9 @@ class PosixPath(Path, PurePosixPath):
14251425

14261426
class WindowsPath(Path, PureWindowsPath):
14271427
__slots__ = ()
1428+
1429+
def owner(self):
1430+
raise NotImplementedError("Path.owner() is unsupported on this system")
1431+
1432+
def group(self):
1433+
raise NotImplementedError("Path.group() is unsupported on this system")

Lib/test/test_pathlib.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,15 @@ def test_is_reserved(self):
11561156
# UNC paths are never reserved
11571157
self.assertIs(False, P('//my/share/nul/con/aux').is_reserved())
11581158

1159+
def test_owner(self):
1160+
P = self.cls
1161+
with self.assertRaises(NotImplementedError):
1162+
P('c:/').owner()
1163+
1164+
def test_group(self):
1165+
P = self.cls
1166+
with self.assertRaises(NotImplementedError):
1167+
P('c:/').group()
11591168

11601169
class PurePathTest(_BasePurePathTest, unittest.TestCase):
11611170
cls = pathlib.PurePath

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ Core and Builtins
201201
Library
202202
-------
203203

204+
- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
205+
NotImplementedError instead of ImportError.
206+
204207
- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.
205208

206209
- Issue #21042: Make ctypes.util.find_library() return the full path on

0 commit comments

Comments
 (0)