mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Use global statement instead of importing ourselves to get to global
variable.
This commit is contained in:
parent
453ced57dc
commit
e5fe4af070
@ -22,14 +22,10 @@ def stat(path):
|
||||
|
||||
|
||||
# Reset the cache completely.
|
||||
# Hack: to reset a global variable, we import this module.
|
||||
#
|
||||
def reset():
|
||||
import statcache
|
||||
# Check that we really imported the same module
|
||||
if cache is not statcache.cache:
|
||||
raise 'sorry, statcache identity crisis'
|
||||
statcache.cache = {}
|
||||
global cache
|
||||
cache = {}
|
||||
|
||||
|
||||
# Remove a given item from the cache, if it exists.
|
||||
|
Loading…
Reference in New Issue
Block a user