Show More
@@ -1642,7 +1642,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1642 | return |
|
1642 | return | |
1643 |
|
1643 | |||
1644 | # Control the response to exit() calls made by the script being run |
|
1644 | # Control the response to exit() calls made by the script being run | |
1645 |
exit_ignore = |
|
1645 | exit_ignore = 'e' in opts | |
1646 |
|
1646 | |||
1647 | # Make sure that the running script gets a proper sys.argv as if it |
|
1647 | # Make sure that the running script gets a proper sys.argv as if it | |
1648 | # were run from a system shell. |
|
1648 | # were run from a system shell. | |
@@ -1653,7 +1653,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1653 |
|
1653 | |||
1654 | sys.argv = [filename]+ args # put in the proper filename |
|
1654 | sys.argv = [filename] + args # put in the proper filename | |
1655 |
|
1655 | |||
1656 |
if |
|
1656 | if 'i' in opts: | |
1657 | # Run in user's interactive namespace |
|
1657 | # Run in user's interactive namespace | |
1658 | prog_ns = self.shell.user_ns |
|
1658 | prog_ns = self.shell.user_ns | |
1659 | __name__save = self.shell.user_ns['__name__'] |
|
1659 | __name__save = self.shell.user_ns['__name__'] | |
@@ -1661,7 +1661,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1661 | main_mod = self.shell.new_main_mod(prog_ns) |
|
1661 | main_mod = self.shell.new_main_mod(prog_ns) | |
1662 | else: |
|
1662 | else: | |
1663 | # Run in a fresh, empty namespace |
|
1663 | # Run in a fresh, empty namespace | |
1664 |
if |
|
1664 | if 'n' in opts: | |
1665 | name = os.path.splitext(os.path.basename(filename))[0] |
|
1665 | name = os.path.splitext(os.path.basename(filename))[0] | |
1666 | else: |
|
1666 | else: | |
1667 | name = '__main__' |
|
1667 | name = '__main__' | |
@@ -1690,10 +1690,10 b' Currently the magic system has the following functions:\\n"""' | |||||
1690 | try: |
|
1690 | try: | |
1691 | stats = None |
|
1691 | stats = None | |
1692 | with self.readline_no_record: |
|
1692 | with self.readline_no_record: | |
1693 |
if |
|
1693 | if 'p' in opts: | |
1694 | stats = self.magic_prun('',0,opts,arg_lst,prog_ns) |
|
1694 | stats = self.magic_prun('', 0, opts, arg_lst, prog_ns) | |
1695 | else: |
|
1695 | else: | |
1696 |
if |
|
1696 | if 'd' in opts: | |
1697 | deb = debugger.Pdb(self.shell.colors) |
|
1697 | deb = debugger.Pdb(self.shell.colors) | |
1698 | # reset Breakpoint state, which is moronically kept |
|
1698 | # reset Breakpoint state, which is moronically kept | |
1699 | # in a class |
|
1699 | # in a class | |
@@ -1733,7 +1733,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1733 | else: |
|
1733 | else: | |
1734 | if runner is None: |
|
1734 | if runner is None: | |
1735 | runner = self.shell.safe_execfile |
|
1735 | runner = self.shell.safe_execfile | |
1736 |
if |
|
1736 | if 't' in opts: | |
1737 | # timed execution |
|
1737 | # timed execution | |
1738 | try: |
|
1738 | try: | |
1739 | nruns = int(opts['N'][0]) |
|
1739 | nruns = int(opts['N'][0]) | |
@@ -1774,7 +1774,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1774 | # regular execution |
|
1774 | # regular execution | |
1775 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) |
|
1775 | runner(filename, prog_ns, prog_ns, exit_ignore=exit_ignore) | |
1776 |
|
1776 | |||
1777 |
if |
|
1777 | if 'i' in opts: | |
1778 | self.shell.user_ns['__name__'] = __name__save |
|
1778 | self.shell.user_ns['__name__'] = __name__save | |
1779 | else: |
|
1779 | else: | |
1780 | # The shell MUST hold a reference to prog_ns so after %run |
|
1780 | # The shell MUST hold a reference to prog_ns so after %run |
General Comments 0
You need to be logged in to leave comments.
Login now