File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 5
5
that name.
6
6
"""
7
7
8
- import sys
9
- import os
10
-
11
8
__all__ = ["getline" , "clearcache" , "checkcache" , "lazycache" ]
12
9
13
10
@@ -67,15 +64,22 @@ def checkcache(filename=None):
67
64
if mtime is None :
68
65
continue # no-op for files loaded via a __loader__
69
66
try :
67
+ # This import can fail if the interpreter is shutting down
68
+ import os
70
69
stat = os .stat (fullname )
71
70
except OSError :
72
71
cache .pop (filename , None )
73
72
continue
73
+ except ImportError :
74
+ return
74
75
if size != stat .st_size or mtime != stat .st_mtime :
75
76
cache .pop (filename , None )
76
77
77
78
78
79
def updatecache (filename , module_globals = None ):
80
+ import os
81
+ import sys
82
+
79
83
"""Update a cache entry and return its list of lines.
80
84
If something's wrong, print a message, discard the cache entry,
81
85
and return an empty list."""
You can’t perform that action at this time.
0 commit comments