mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
GH-74033: Drop deprecated pathlib.Path
keyword arguments (#118793)
Remove support for supplying keyword arguments to `pathlib.Path()`. This has been deprecated since Python 3.12.
This commit is contained in:
parent
fbe6a0988f
commit
7d8725ac6f
4 changed files with 5 additions and 9 deletions
|
@ -483,13 +483,6 @@ class Path(PathBase, PurePath):
|
|||
def _unsupported_msg(cls, attribute):
|
||||
return f"{cls.__name__}.{attribute} is unsupported on this system"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if kwargs:
|
||||
msg = ("support for supplying keyword arguments to pathlib.PurePath "
|
||||
"is deprecated and scheduled for removal in Python {remove}")
|
||||
warnings._deprecated("pathlib.PurePath(**kwargs)", msg, remove=(3, 14))
|
||||
super().__init__(*args)
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if cls is Path:
|
||||
cls = WindowsPath if os.name == 'nt' else PosixPath
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue