mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
[3.13] gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) (GH-122348)
(cherry picked from commit 7a6d4ccf0e
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
40925103fc
commit
3648a945e4
3 changed files with 37 additions and 2 deletions
|
@ -70,7 +70,7 @@ def checkcache(filename=None):
|
|||
return
|
||||
try:
|
||||
stat = os.stat(fullname)
|
||||
except OSError:
|
||||
except (OSError, ValueError):
|
||||
cache.pop(filename, None)
|
||||
continue
|
||||
if size != stat.st_size or mtime != stat.st_mtime:
|
||||
|
@ -135,10 +135,12 @@ def updatecache(filename, module_globals=None):
|
|||
try:
|
||||
stat = os.stat(fullname)
|
||||
break
|
||||
except OSError:
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
else:
|
||||
return []
|
||||
except ValueError: # may be raised by os.stat()
|
||||
return []
|
||||
try:
|
||||
with tokenize.open(fullname) as fp:
|
||||
lines = fp.readlines()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue