Show More
@@ -1684,28 +1684,28 b' class InteractiveShell(SingletonConfigurable):' | |||||
1684 | self.custom_exceptions = exc_tuple |
|
1684 | self.custom_exceptions = exc_tuple | |
1685 |
|
1685 | |||
1686 | def excepthook(self, etype, value, tb): |
|
1686 | def excepthook(self, etype, value, tb): | |
1687 | """One more defense for GUI apps that call sys.excepthook. |
|
1687 | """One more defense for GUI apps that call sys.excepthook. | |
1688 |
|
1688 | |||
1689 | GUI frameworks like wxPython trap exceptions and call |
|
1689 | GUI frameworks like wxPython trap exceptions and call | |
1690 | sys.excepthook themselves. I guess this is a feature that |
|
1690 | sys.excepthook themselves. I guess this is a feature that | |
1691 | enables them to keep running after exceptions that would |
|
1691 | enables them to keep running after exceptions that would | |
1692 | otherwise kill their mainloop. This is a bother for IPython |
|
1692 | otherwise kill their mainloop. This is a bother for IPython | |
1693 | which excepts to catch all of the program exceptions with a try: |
|
1693 | which excepts to catch all of the program exceptions with a try: | |
1694 | except: statement. |
|
1694 | except: statement. | |
1695 |
|
1695 | |||
1696 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if |
|
1696 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if | |
1697 | any app directly invokes sys.excepthook, it will look to the user like |
|
1697 | any app directly invokes sys.excepthook, it will look to the user like | |
1698 | IPython crashed. In order to work around this, we can disable the |
|
1698 | IPython crashed. In order to work around this, we can disable the | |
1699 | CrashHandler and replace it with this excepthook instead, which prints a |
|
1699 | CrashHandler and replace it with this excepthook instead, which prints a | |
1700 | regular traceback using our InteractiveTB. In this fashion, apps which |
|
1700 | regular traceback using our InteractiveTB. In this fashion, apps which | |
1701 | call sys.excepthook will generate a regular-looking exception from |
|
1701 | call sys.excepthook will generate a regular-looking exception from | |
1702 | IPython, and the CrashHandler will only be triggered by real IPython |
|
1702 | IPython, and the CrashHandler will only be triggered by real IPython | |
1703 | crashes. |
|
1703 | crashes. | |
1704 |
|
1704 | |||
1705 | This hook should be used sparingly, only in places which are not likely |
|
1705 | This hook should be used sparingly, only in places which are not likely | |
1706 | to be true IPython errors. |
|
1706 | to be true IPython errors. | |
1707 | """ |
|
1707 | """ | |
1708 | self.showtraceback((etype, value, tb), tb_offset=0) |
|
1708 | self.showtraceback((etype, value, tb), tb_offset=0) | |
1709 |
|
1709 | |||
1710 | def _get_exc_info(self, exc_tuple=None): |
|
1710 | def _get_exc_info(self, exc_tuple=None): | |
1711 | """get exc_info from a given tuple, sys.exc_info() or sys.last_type etc. |
|
1711 | """get exc_info from a given tuple, sys.exc_info() or sys.last_type etc. |
General Comments 0
You need to be logged in to leave comments.
Login now