Show More
@@ -441,11 +441,17 b' class Pdb(OldPdb):' | |||||
441 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
|
441 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) | |
442 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal) |
|
442 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal) | |
443 | src = [] |
|
443 | src = [] | |
|
444 | if filename == "<string>" and hasattr(self, "_exec_filename"): | |||
|
445 | lines = list(open(self._exec_filename)) | |||
|
446 | else: | |||
444 | lines = linecache.getlines(filename) |
|
447 | lines = linecache.getlines(filename) | |
445 | try: |
|
448 | try: | |
446 | encoding, _ = openpy.detect_encoding(_readline(lines)) |
|
449 | encoding, _ = openpy.detect_encoding(_readline(lines)) | |
447 | except SyntaxError: |
|
450 | except SyntaxError: | |
448 | encoding = "ascii" |
|
451 | encoding = "ascii" | |
|
452 | if not lines: | |||
|
453 | print >>io.stdout, "No src could be located using filename: %r"%filename | |||
|
454 | return #Bailing out, there is nothing to see here | |||
449 | for lineno in range(first, last+1): |
|
455 | for lineno in range(first, last+1): | |
450 | line = py3compat.cast_unicode(lines[lineno]) |
|
456 | line = py3compat.cast_unicode(lines[lineno]) | |
451 | if not line: |
|
457 | if not line: |
@@ -554,6 +554,8 b' python-profiler package from non-free.""")' | |||||
554 | print "%s prompt to start your script." % deb.prompt |
|
554 | print "%s prompt to start your script." % deb.prompt | |
555 | ns = {'execfile': py3compat.execfile, 'prog_ns': prog_ns} |
|
555 | ns = {'execfile': py3compat.execfile, 'prog_ns': prog_ns} | |
556 | try: |
|
556 | try: | |
|
557 | #save filename so it can be used by methods on the deb object | |||
|
558 | deb._exec_filename = filename | |||
557 | deb.run('execfile("%s", prog_ns)' % filename, ns) |
|
559 | deb.run('execfile("%s", prog_ns)' % filename, ns) | |
558 |
|
560 | |||
559 | except: |
|
561 | except: |
General Comments 0
You need to be logged in to leave comments.
Login now