Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class Path(PurePath):
"""
__slots__ = ()

def __new__(cls, *args, **kwargs):
def __new__(cls, *args):
Comment thread
uriyyo marked this conversation as resolved.
Outdated
if cls is Path:
cls = WindowsPath if os.name == 'nt' else PosixPath
self = cls._from_parts(args)
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ def test_pickling_common(self):
self.assertEqual(hash(pp), hash(p))
self.assertEqual(str(pp), str(p))

def test_kwargs(self):
with self.assertRaisesRegex(TypeError, 'got an unexpected keyword argument'):
self.cls(arg=None)


class PurePosixPathTest(_BasePurePathTest, unittest.TestCase):
cls = pathlib.PurePosixPath
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where :class:`pathlib.Path` accepted and ignored keyword arguments. Patch provided by Yurii Karabas.
Comment thread
brettcannon marked this conversation as resolved.
Outdated