]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119049: Defer `import warnings` in `pathlib._local` (#119111)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Fri, 17 May 2024 16:12:02 +0000 (19:12 +0300)
committerGitHub <noreply@github.com>
Fri, 17 May 2024 16:12:02 +0000 (17:12 +0100)
Lib/pathlib/_local.py

index 011144a565540f24a39cb5eac3cad078057c5082..f2776b1d20a2ea6160a7f3dd3a42c91e05ba70ba 100644 (file)
@@ -4,7 +4,6 @@ import operator
 import os
 import posixpath
 import sys
-import warnings
 from glob import _StringGlobber
 from itertools import chain
 from _collections_abc import Sequence
@@ -405,6 +404,7 @@ class PurePath(PurePathBase):
     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.")