浏览代码

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

Jelmer Vernooij 4 年之前
父节点
当前提交
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=".")