gh-133875: Remove deprecated pathlib.PurePath.is_reserved (#133876)

This commit is contained in:
sobolevn 2025-07-19 20:07:46 +03:00 committed by GitHub
parent 7ae4749d06
commit 67036f1ee1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 15 additions and 36 deletions

View file

@ -519,18 +519,6 @@ class PurePath:
return False
return self.parser.isabs(self)
def is_reserved(self):
"""Return True if the path contains one of the special names reserved
by the system, if any."""
import warnings
msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled "
"for removal in Python 3.15. Use os.path.isreserved() to "
"detect reserved paths on Windows.")
warnings._deprecated("pathlib.PurePath.is_reserved", msg, remove=(3, 15))
if self.parser is ntpath:
return self.parser.isreserved(self)
return False
def as_uri(self):
"""Return the path as a URI."""
import warnings

View file

@ -539,12 +539,6 @@ class PurePathTest(unittest.TestCase):
self.assertRaises(ValueError, P('a/b').with_stem, '')
self.assertRaises(ValueError, P('a/b').with_stem, '.')
def test_is_reserved_deprecated(self):
P = self.cls
p = P('a/b')
with self.assertWarns(DeprecationWarning):
p.is_reserved()
def test_full_match_case_sensitive(self):
P = self.cls
self.assertFalse(P('A.py').full_match('a.PY', case_sensitive=True))