Show More
@@ -20,6 +20,7 b' import bdb' | |||||
20 | import os |
|
20 | import os | |
21 | import sys |
|
21 | import sys | |
22 | import time |
|
22 | import time | |
|
23 | from pdb import Restart | |||
23 |
|
24 | |||
24 | # cProfile was added in Python2.5 |
|
25 | # cProfile was added in Python2.5 | |
25 | try: |
|
26 | try: | |
@@ -665,7 +666,11 b' python-profiler package from non-free.""")' | |||||
665 | 'modulename': modulename, |
|
666 | 'modulename': modulename, | |
666 | } |
|
667 | } | |
667 | else: |
|
668 | else: | |
668 | code = 'execfile(filename, prog_ns)' |
|
669 | if 'd' in opts: | |
|
670 | # allow exceptions to raise in debug mode | |||
|
671 | code = 'execfile(filename, prog_ns, raise_exceptions=True)' | |||
|
672 | else: | |||
|
673 | code = 'execfile(filename, prog_ns)' | |||
669 | code_ns = { |
|
674 | code_ns = { | |
670 | 'execfile': self.shell.safe_execfile, |
|
675 | 'execfile': self.shell.safe_execfile, | |
671 | 'prog_ns': prog_ns, |
|
676 | 'prog_ns': prog_ns, | |
@@ -807,7 +812,18 b' python-profiler package from non-free.""")' | |||||
807 | if filename: |
|
812 | if filename: | |
808 | # save filename so it can be used by methods on the deb object |
|
813 | # save filename so it can be used by methods on the deb object | |
809 | deb._exec_filename = filename |
|
814 | deb._exec_filename = filename | |
810 | deb.run(code, code_ns) |
|
815 | while True: | |
|
816 | try: | |||
|
817 | deb.run(code, code_ns) | |||
|
818 | except Restart: | |||
|
819 | print("Restarting") | |||
|
820 | if filename: | |||
|
821 | deb._wait_for_mainpyfile = True | |||
|
822 | deb.mainpyfile = deb.canonic(filename) | |||
|
823 | continue | |||
|
824 | else: | |||
|
825 | break | |||
|
826 | ||||
811 |
|
827 | |||
812 | except: |
|
828 | except: | |
813 | etype, value, tb = sys.exc_info() |
|
829 | etype, value, tb = sys.exc_info() |
General Comments 0
You need to be logged in to leave comments.
Login now