summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2021-09-08 10:25:09 (GMT)
committerGitHub <noreply@github.com>2021-09-08 10:25:09 (GMT)
commitc11956a8bddd75f02ccc7b4da7e4d8123e1f3c5f (patch)
treeb3c94d1e1dbfda311a8b94fe5a0918df7ac0a121 /Lib/test/test_typing.py
parentd003a5bd2505a7fa04f50504b68ba8fca67349cd (diff)
downloadcpython-c11956a8bddd75f02ccc7b4da7e4d8123e1f3c5f.zip
cpython-c11956a8bddd75f02ccc7b4da7e4d8123e1f3c5f.tar.gz
cpython-c11956a8bddd75f02ccc7b4da7e4d8123e1f3c5f.tar.bz2
bpo-45121: Fix RecursionError when calling Protocol.__init__ from a subclass' __init__ (GH-28206)
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 847d583..fa49b90 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -1610,6 +1610,16 @@ class ProtocolTests(BaseTestCase):
with self.assertRaisesRegex(TypeError, "@runtime_checkable"):
isinstance(1, P)
+ def test_super_call_init(self):
+ class P(Protocol):
+ x: int
+
+ class Foo(P):
+ def __init__(self):
+ super().__init__()
+
+ Foo() # Previously triggered RecursionError
+
class GenericTests(BaseTestCase):