From f0c73b4ab75a260a010c1ed83373b29b76980374 Mon Sep 17 00:00:00 2001 From: Michael Graczyk Date: Fri, 22 Nov 2019 17:45:46 -0800 Subject: [PATCH] issue-25872: Fix KeyError using linecache from multiple threads --- Lib/linecache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/linecache.py b/Lib/linecache.py index 3afcce1f0a1456..c87e1807bfafaa 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -73,10 +73,10 @@ def checkcache(filename=None): try: stat = os.stat(fullname) except OSError: - del cache[filename] + cache.pop(filename, None) continue if size != stat.st_size or mtime != stat.st_mtime: - del cache[filename] + cache.pop(filename, None) def updatecache(filename, module_globals=None): @@ -86,7 +86,7 @@ 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 [] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy