2
0
Эх сурвалжийг харах

Defer tempfile import, since it pulls in a lot of other modules.

Jelmer Vernooij 4 жил өмнө
parent
commit
bb62a537d0
1 өөрчлөгдсөн 2 нэмэгдсэн , 1 устгасан
  1. 2 1
      dulwich/file.py

+ 2 - 1
dulwich/file.py

@@ -23,7 +23,6 @@
 import io
 import os
 import sys
-import tempfile
 
 
 def ensure_dir_exists(dirname):
@@ -43,6 +42,8 @@ def _fancy_rename(oldname, newname):
             raise
         return
 
+    # Defer the tempfile import since it pulls in a lot of other things.
+    import tempfile
     # destination file exists
     try:
         (fd, tmpfile) = tempfile.mkstemp(".tmp", prefix=oldname, dir=".")