gh-119049: Defer import warnings in pathlib._local (#119111)

This commit is contained in:
Kirill Podoprigora 2024-05-17 19:12:02 +03:00 committed by GitHub
parent 447edb6e98
commit 31a28cbae0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,6 @@ import operator
import os import os
import posixpath import posixpath
import sys import sys
import warnings
from glob import _StringGlobber from glob import _StringGlobber
from itertools import chain from itertools import chain
from _collections_abc import Sequence from _collections_abc import Sequence
@ -405,6 +404,7 @@ class PurePath(PurePathBase):
def is_reserved(self): def is_reserved(self):
"""Return True if the path contains one of the special names reserved """Return True if the path contains one of the special names reserved
by the system, if any.""" by the system, if any."""
import warnings
msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled " msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled "
"for removal in Python 3.15. Use os.path.isreserved() to " "for removal in Python 3.15. Use os.path.isreserved() to "
"detect reserved paths on Windows.") "detect reserved paths on Windows.")