mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-92336: linecache.getline should not raise exceptions on decoding errors (GH-94410)
This commit is contained in:
parent
68fb03249f
commit
21cbdae90f
3 changed files with 8 additions and 7 deletions
|
@ -135,7 +135,7 @@ def updatecache(filename, module_globals=None):
|
|||
try:
|
||||
with tokenize.open(fullname) as fp:
|
||||
lines = fp.readlines()
|
||||
except OSError:
|
||||
except (OSError, UnicodeDecodeError, SyntaxError):
|
||||
return []
|
||||
if lines and not lines[-1].endswith('\n'):
|
||||
lines[-1] += '\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue