about the module. See its documentation for details.
"""
sb = os.stat(path)
- cachelock.acquire()
- try:
+ with cachelock:
if path in modcache:
entry = modcache[path]
if sb.st_mtime <= entry.mtime:
entry = cachedmod(mod, sb.st_mtime)
modcache[path] = entry
return entry
- finally:
- cachelock.release()
def chain(env, startreq):
path = env["SCRIPT_FILENAME"]
mod = getmod(path)
entry = None
if mod is not None:
- mod.lock.acquire()
- try:
+ with mod.lock:
if hasattr(mod, "entry"):
entry = mod.entry
else:
elif hasattr(mod.mod, "application"):
entry = mod.mod.application
mod.entry = entry
- finally:
- mod.lock.release()
if entry is not None:
return entry(env, startreq)
return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Invalid WSGI handler.")