summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-21 19:36:23 (GMT)
committerGitHub <noreply@github.com>2020-06-21 19:36:23 (GMT)
commit14195597b3a877209c20d00e0ec844234e624d13 (patch)
treed50c4f5053699320d0b81c133779582d7b17123e /Lib/pdb.py
parent10bf6e482328f622f4b2659e4ad5e3d88f57ba58 (diff)
downloadcpython-14195597b3a877209c20d00e0ec844234e624d13.zip
cpython-14195597b3a877209c20d00e0ec844234e624d13.tar.gz
cpython-14195597b3a877209c20d00e0ec844234e624d13.tar.bz2
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
(cherry picked from commit 19fcffa92773e008e4f5efb80047420a0cfafeec) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index bf503f1..931a039 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -79,6 +79,7 @@ import glob
import pprint
import signal
import inspect
+import tokenize
import traceback
import linecache
@@ -93,7 +94,7 @@ __all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace",
def find_function(funcname, filename):
cre = re.compile(r'def\s+%s\s*[(]' % re.escape(funcname))
try:
- fp = open(filename)
+ fp = tokenize.open(filename)
except OSError:
return None
# consumer of this info expects the first line to be 1