[3.8] bpo-25872: Fix KeyError using linecache from multiple threads (GH-20079) by miss-islington · Pull Request #20079 · python/cpython
def updatecache(filename, module_globals=None):
if filename in cache: if len(cache[filename]) != 1: del cache[filename] cache.pop(filename, None) if not filename or (filename.startswith('<') and filename.endswith('>')): return []