Show More
@@ -238,7 +238,7 b' class Pdb(OldPdb):' | |||
|
238 | 238 | self.shell = TerminalInteractiveShell.instance() |
|
239 | 239 | # needed by any code which calls __import__("__main__") after |
|
240 | 240 | # the debugger was entered. See also #9941. |
|
241 |
sys.modules[ |
|
|
241 | sys.modules["__main__"] = save_main | |
|
242 | 242 | |
|
243 | 243 | if color_scheme is not None: |
|
244 | 244 | warnings.warn( |
@@ -323,10 +323,10 b' class Pdb(OldPdb):' | |||
|
323 | 323 | def precmd(self, line): |
|
324 | 324 | """Perform useful escapes on the command before it is executed.""" |
|
325 | 325 | |
|
326 |
if line.endswith( |
|
|
327 |
line = |
|
|
328 |
elif line.endswith( |
|
|
329 |
line = |
|
|
326 | if line.endswith("??"): | |
|
327 | line = "pinfo2 " + line[:-2] | |
|
328 | elif line.endswith("?"): | |
|
329 | line = "pinfo " + line[:-1] | |
|
330 | 330 | |
|
331 | 331 | line = super().precmd(line) |
|
332 | 332 | |
@@ -414,11 +414,10 b' class Pdb(OldPdb):' | |||
|
414 | 414 | |
|
415 | 415 | Colors = self.color_scheme_table.active_colors |
|
416 | 416 | ColorsNormal = Colors.Normal |
|
417 |
tpl_link = |
|
|
418 |
tpl_call = |
|
|
419 |
tpl_line = |
|
|
420 |
tpl_line_em = |
|
|
421 | ColorsNormal) | |
|
417 | tpl_link = "%s%%s%s" % (Colors.filenameEm, ColorsNormal) | |
|
418 | tpl_call = "%s%%s%s%%s%s" % (Colors.vName, Colors.valEm, ColorsNormal) | |
|
419 | tpl_line = "%%s%s%%s %s%%s" % (Colors.lineno, ColorsNormal) | |
|
420 | tpl_line_em = "%%s%s%%s %s%%s%s" % (Colors.linenoEm, Colors.line, ColorsNormal) | |
|
422 | 421 | |
|
423 | 422 | frame, lineno = frame_lineno |
|
424 | 423 | |
@@ -451,8 +450,8 b' class Pdb(OldPdb):' | |||
|
451 | 450 | if frame is self.curframe: |
|
452 | 451 | ret.append('> ') |
|
453 | 452 | else: |
|
454 |
ret.append( |
|
|
455 |
ret.append( |
|
|
453 | ret.append(" ") | |
|
454 | ret.append("%s(%s)%s\n" % (link, lineno, call)) | |
|
456 | 455 | |
|
457 | 456 | start = lineno - 1 - context//2 |
|
458 | 457 | lines = linecache.getlines(filename) |
@@ -461,14 +460,14 b' class Pdb(OldPdb):' | |||
|
461 | 460 | lines = lines[start : start + context] |
|
462 | 461 | |
|
463 | 462 | for i, line in enumerate(lines): |
|
464 |
show_arrow = |
|
|
465 |
linetpl = (frame is self.curframe or show_arrow) |
|
|
466 | and tpl_line_em \ | |
|
467 |
|
|
|
468 | ret.append(self.__format_line(linetpl, filename, | |
|
469 | start + 1 + i, line, | |
|
470 | arrow=show_arrow)) | |
|
471 |
return |
|
|
463 | show_arrow = start + 1 + i == lineno | |
|
464 | linetpl = (frame is self.curframe or show_arrow) and tpl_line_em or tpl_line | |
|
465 | ret.append( | |
|
466 | self.__format_line( | |
|
467 | linetpl, filename, start + 1 + i, line, arrow=show_arrow | |
|
468 | ) | |
|
469 | ) | |
|
470 | return "".join(ret) | |
|
472 | 471 | |
|
473 | 472 | def __format_line(self, tpl_line, filename, lineno, line, arrow=False): |
|
474 | 473 | bp_mark = "" |
@@ -518,9 +517,13 b' class Pdb(OldPdb):' | |||
|
518 | 517 | break |
|
519 | 518 | |
|
520 | 519 | if lineno == self.curframe.f_lineno: |
|
521 |
line = self.__format_line( |
|
|
520 | line = self.__format_line( | |
|
521 | tpl_line_em, filename, lineno, line, arrow=True | |
|
522 | ) | |
|
522 | 523 | else: |
|
523 |
line = self.__format_line( |
|
|
524 | line = self.__format_line( | |
|
525 | tpl_line, filename, lineno, line, arrow=False | |
|
526 | ) | |
|
524 | 527 | |
|
525 | 528 | src.append(line) |
|
526 | 529 | self.lineno = lineno |
@@ -39,10 +39,9 b' class TerminalPdb(Pdb):' | |||
|
39 | 39 | return [(Token.Prompt, self.prompt)] |
|
40 | 40 | |
|
41 | 41 | if self._ptcomp is None: |
|
42 |
compl = IPCompleter( |
|
|
43 | namespace={}, | |
|
44 | global_namespace={}, | |
|
45 | parent=self.shell) | |
|
42 | compl = IPCompleter( | |
|
43 | shell=self.shell, namespace={}, global_namespace={}, parent=self.shell | |
|
44 | ) | |
|
46 | 45 | # add a completer for all the do_ methods |
|
47 | 46 | methods_names = [m[3:] for m in dir(self) if m.startswith("do_")] |
|
48 | 47 |
General Comments 0
You need to be logged in to leave comments.
Login now