From 79779f87a5553132b50e63bfbdbcf133fc32b359 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Wed, 19 May 2021 17:23:02 -0400 Subject: [PATCH] Add '_py_abc' to the frame stack This restores an alteration made by @coolreader18 a while back. --- Lib/typing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/typing.py b/Lib/typing.py index 29205af7b..bc476438e 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -989,7 +989,9 @@ def _allow_reckless_class_cheks(): issubclass() on the whole MRO of a user class, which may contain protocols. """ try: - return sys._getframe(3).f_globals['__name__'] in ['abc', 'functools'] + # XXX RUSTPYTHON: added _py_abc; I think CPython was fine because abc called + # directly into the _abc builtin module, which wasn't in the frame stack + return sys._getframe(3).f_globals['__name__'] in ['abc', 'functools', '_py_abc'] except (AttributeError, ValueError): # For platforms without _getframe(). return True