Skip to content

Commit 349374d

Browse files
Unify how FrameType and FrameLocalsProxyType are created.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 59daace commit 349374d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def _m(self): pass
5858
raise TypeError
5959
except TypeError as exc:
6060
TracebackType = type(exc.__traceback__)
61-
FrameType = type(exc.__traceback__.tb_frame)
61+
62+
_f = (lambda: sys._getframe())()
63+
FrameType = type(_f)
64+
FrameLocalsProxyType = type(_f.f_locals)
6265

6366
GetSetDescriptorType = type(FunctionType.__code__)
6467
MemberDescriptorType = type(FunctionType.__globals__)
@@ -69,7 +72,6 @@ def _m(self): pass
6972
EllipsisType = type(Ellipsis)
7073
NoneType = type(None)
7174
NotImplementedType = type(NotImplemented)
72-
FrameLocalsProxyType = (lambda: type(sys._getframe().f_locals))()
7375

7476
# CapsuleType cannot be accessed from pure Python,
7577
# so there is no fallback definition.

0 commit comments

Comments
 (0)