File: min-ntpath-import.diff

package info (click to toggle)
python3.13 3.13.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 121,328 kB
  • sloc: python: 704,014; ansic: 653,914; xml: 31,250; sh: 5,844; cpp: 4,326; makefile: 1,981; objc: 787; lisp: 502; javascript: 213; asm: 75; csh: 12
file content (35 lines) | stat: -rw-r--r-- 1,132 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: ntpath is not in python-minimal, replace module-level imports with
 local imports in functions that actually require ntpath.
Forwarded: not-needed
--- a/Lib/pathlib/_local.py
+++ b/Lib/pathlib/_local.py
@@ -1,5 +1,4 @@
 import io
-import ntpath
 import operator
 import os
 import posixpath
@@ -115,6 +114,7 @@
         return object.__new__(cls)
 
     def __init__(self, *args):
+        import ntpath
         paths = []
         for arg in args:
             if isinstance(arg, PurePath):
@@ -417,6 +417,7 @@
     def is_reserved(self):
         """Return True if the path contains one of the special names reserved
         by the system, if any."""
+        import ntpath
         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.")
@@ -475,6 +476,7 @@
     On a Windows system, instantiating a PurePath should return this object.
     However, you can also instantiate it directly on any system.
     """
+    import ntpath
     parser = ntpath
     __slots__ = ()