bpo-46510: Add missing test for types.TracebackType/FrameType. Calculate them directly from the caught exception. (GH-30880)

This commit is contained in:
Irit Katriel 2022-01-25 18:00:57 +00:00 committed by GitHub
parent d69d3d8b2f
commit ec7c17ea23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -52,11 +52,9 @@ ModuleType = type(sys)
try:
raise TypeError
except TypeError:
tb = sys.exc_info()[2]
TracebackType = type(tb)
FrameType = type(tb.tb_frame)
tb = None; del tb
except TypeError as exc:
TracebackType = type(exc.__traceback__)
FrameType = type(exc.__traceback__.tb_frame)
# For Jython, the following two types are identical
GetSetDescriptorType = type(FunctionType.__code__)