summaryrefslogtreecommitdiffstats
path: root/Lib/linecache.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-06-30 09:18:18 (GMT)
committerGitHub <noreply@github.com>2022-06-30 09:18:18 (GMT)
commit21cbdae90ffdac047d27d1b83a5442fabcf89f7c (patch)
tree8cead832cdbbd9b4ab28e8c7b87cf8ba6d3e667f /Lib/linecache.py
parent68fb03249f3b17146db42b00a75718b823a2280c (diff)
downloadcpython-21cbdae90ffdac047d27d1b83a5442fabcf89f7c.zip
cpython-21cbdae90ffdac047d27d1b83a5442fabcf89f7c.tar.gz
cpython-21cbdae90ffdac047d27d1b83a5442fabcf89f7c.tar.bz2
gh-92336: linecache.getline should not raise exceptions on decoding errors (GH-94410)
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r--Lib/linecache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index 23191d6..97644a8 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -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'