mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
This commit is contained in:
parent
6c4e0bd974
commit
19fcffa927
3 changed files with 42 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue