File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1111import asyncio
1212import enum
1313import logging
14+ import sys
1415import traceback
1516from base64 import b64decode , b64encode
1617from collections .abc import MutableMapping
5758
5859PRIMITIVE_TYPES = (int , float , bool , str )
5960
61+ if sys .version_info >= (3 , 10 ):
62+
63+ def format_exception (e : Exception ) -> str :
64+ return "" .join (traceback .format_exception (e ))
65+
66+ else :
67+
68+ def format_exception (e : Exception ) -> str :
69+ return "" .join (traceback .format_exception (e .__class__ , e , e .__traceback__ ))
70+
6071
6172def find_subclasses (cls : Type [T ]) -> ListType [Type [T ]]:
6273 """Finds subclasses of the given class"""
@@ -769,7 +780,7 @@ def __log_restore_error__(
769780 f"\n Ref: { self .__ref__ } "
770781 f"\n Scope: { pformat (scope )} "
771782 f"\n State: { pformat (state )} "
772- f"\n { '' . join ( traceback . format_exception (e ) )} "
783+ f"\n { format_exception (e )} "
773784 )
774785
775786 # --------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments