Fixed a few type mismatches in pdb (#125952)

This commit is contained in:
Tian Gao 2024-10-24 21:17:58 -07:00 committed by GitHub
parent 371c537dff
commit 2513593303
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,7 +127,7 @@ def find_function(funcname, filename):
return None return None
fp = io.StringIO(''.join(lines)) fp = io.StringIO(''.join(lines))
funcdef = "" funcdef = ""
funcstart = None funcstart = 0
# consumer of this info expects the first line to be 1 # consumer of this info expects the first line to be 1
with fp: with fp:
for lineno, line in enumerate(fp, start=1): for lineno, line in enumerate(fp, start=1):
@ -783,7 +783,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
if "$" not in line: if "$" not in line:
return line return line
dollar_start = dollar_end = -1 dollar_start = dollar_end = (-1, -1)
replace_variables = [] replace_variables = []
try: try:
for t in tokenize.generate_tokens(io.StringIO(line).readline): for t in tokenize.generate_tokens(io.StringIO(line).readline):
@ -1088,7 +1088,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
complete_commands = _complete_bpnumber complete_commands = _complete_bpnumber
def do_break(self, arg, temporary = 0): def do_break(self, arg, temporary=False):
"""b(reak) [ ([filename:]lineno | function) [, condition] ] """b(reak) [ ([filename:]lineno | function) [, condition] ]
Without argument, list all breaks. Without argument, list all breaks.
@ -1203,7 +1203,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
Same arguments as break, but sets a temporary breakpoint: it Same arguments as break, but sets a temporary breakpoint: it
is automatically deleted when first hit. is automatically deleted when first hit.
""" """
self.do_break(arg, 1) self.do_break(arg, True)
complete_tbreak = _complete_location complete_tbreak = _complete_location