;idZddlZddlZddlZddlZddlmZgagZda dZ dZ dZ dZ dd ZGd d eZeejd rejd seZejZejZdSdS)aThis module installs a wrapper around sys.excepthook and threading.excepthook that allows multiple new exception handlers to be registered. Optionally, the wrapper also stops exceptions from causing long-term storage of local stack frames. This has two major effects: - Unhandled exceptions will no longer cause memory leaks (If an exception occurs while a lot of data is present on the stack, such as when loading large files, the data would ordinarily be kept until the next exception occurs. We would rather release this memory as soon as possible.) - Some debuggers may have a hard time handling uncaught exceptions N)SimpleNamespaceFc:t|dS)aRegister a callable to be invoked when there is an unhandled exception. The callback will be passed an object with attributes: [exc_type, exc_value, exc_traceback, thread] (see threading.excepthook). Multiple callbacks will be invoked in the order they were registered. N) callbacksappendfns OC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\pyqtgraph/exceptionHandling.pyregisterCallbackr s Rc:t|dS)z1Unregister a previously registered callback. N)rremovers r unregisterCallbackr!sRr c:t|dS)a!Deprecated; see registerCallback Register a callable to be invoked when there is an unhandled exception. The callback will be passed the output of sys.exc_info(): (exception type, exception, traceback) Multiple callbacks will be invoked in the order they were registered. N) old_callbacksrrs r registerr'sr c:t|dS)zYDeprecated; see unregisterCallback Unregister a previously registered callback. N)rr rs r unregisterr1s r Tc |adS)a Enable or disable traceback clearing. By default, clearing is disabled and Python will indefinitely store unhandled exception stack traces. This function is provided since Python's default behavior can cause unexpected retention of large memory-consuming objects. N)clear_tracebacks)clears r setTracebackClearingr9sr c4eZdZdZdZdZdZdZddZdS) ExceptionHandlerctj|_tj|_|jt_|jt_dSN)sys excepthookorig_sys_excepthook threadingorig_threading_excepthooksys_excepthookthreading_excepthookselfs r __init__zExceptionHandler.__init__Es2#&> )2)=&,#8 r cJ|jt_|jt_dS)zNRestore original exception hooks, deactivating this exception handler N)rrrr rr#s r r zExceptionHandler.removeKs1#= r czt|d|d|dd}||dS)Nr)exc_type exc_value exc_tracebackthreadFuse_thread_hook)r _excepthookr$argss r r!zExceptionHandler.sys_excepthookQsAQ47RVWXRYbfggge<<>>> ?$ ? ??Bt}dnd6HIIII ???]^^^MPSTVPWPWWXXX]^^^-s|~~>>>> ? 4''%)"  !. 1 1 1 1C !. 1 1 1 1s{AI5BI?CICA I DIA&FIF IF10I1A&HIHIINc|dgS|dkS)Nr)r$ interfaces r implementszExceptionHandler.implementss  &' ' 22 2r r) __name__ __module__ __qualname__r%r r!r"r0rLrJr r rrDst999 >>> === <<<323232j333333r rrL)T)__doc__rrr9rAtypesrrrrr rrrrobjectrhasattrrrLhandlerroriginal_excepthookr original_threading_excepthookrJr r rWsD    !!!!!!    P3P3P3P3P3vP3P3P3j  --F#.2K2KL^2_2_F  G!5$+$E!!!FFr