Show More
@@ -543,25 +543,27 b' python-profiler package from non-free.""")' | |||
|
543 | 543 | # every single object ever created. |
|
544 | 544 | sys.modules[main_mod_name] = main_mod |
|
545 | 545 | |
|
546 | if 'p' in opts or 'd' in opts: | |
|
547 | if 'm' in opts: | |
|
548 | code = 'run_module(modulename, prog_ns)' | |
|
549 | code_ns = { | |
|
550 | 'run_module': self.shell.safe_run_module, | |
|
551 | 'prog_ns': prog_ns, | |
|
552 | 'modulename': modulename, | |
|
553 | } | |
|
554 | else: | |
|
555 | code = 'execfile(filename, prog_ns)' | |
|
556 | code_ns = { | |
|
557 | 'execfile': self.shell.safe_execfile, | |
|
558 | 'prog_ns': prog_ns, | |
|
559 | 'filename': get_py_filename(filename), | |
|
560 | } | |
|
561 | ||
|
546 | 562 | try: |
|
547 | 563 | stats = None |
|
548 | 564 | with self.shell.readline_no_record: |
|
549 | 565 | if 'p' in opts: |
|
550 | if 'm' in opts: | |
|
551 | code = 'run_module(modulename, prog_ns)' | |
|
552 | prun_ns = { | |
|
553 | 'run_module': self.shell.safe_run_module, | |
|
554 | 'prog_ns': prog_ns, | |
|
555 | 'modulename': modulename, | |
|
556 | } | |
|
557 | else: | |
|
558 | code = 'execfile(filename, prog_ns)' | |
|
559 | prun_ns = { | |
|
560 | 'execfile': self.shell.safe_execfile, | |
|
561 | 'prog_ns': prog_ns, | |
|
562 | 'filename': get_py_filename(filename), | |
|
563 | } | |
|
564 | stats = self.prun('', code, False, opts, namespace=prun_ns) | |
|
566 | stats = self.prun('', code, False, opts, namespace=code_ns) | |
|
565 | 567 | else: |
|
566 | 568 | if 'd' in opts: |
|
567 | 569 | deb = debugger.Pdb(self.shell.colors) |
@@ -596,11 +598,10 b' python-profiler package from non-free.""")' | |||
|
596 | 598 | # Start file run |
|
597 | 599 | print "NOTE: Enter 'c' at the", |
|
598 | 600 | print "%s prompt to start your script." % deb.prompt |
|
599 | ns = {'execfile': py3compat.execfile, 'prog_ns': prog_ns} | |
|
600 | 601 | try: |
|
601 | 602 | #save filename so it can be used by methods on the deb object |
|
602 | 603 | deb._exec_filename = filename |
|
603 |
deb.run( |
|
|
604 | deb.run(code, code_ns) | |
|
604 | 605 | |
|
605 | 606 | except: |
|
606 | 607 | etype, value, tb = sys.exc_info() |
General Comments 0
You need to be logged in to leave comments.
Login now