Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge remote-tracking branch 'upstream/main' into fix-issue-44807
# Conflicts:
#	Lib/test/test_typing.py
#	Lib/typing.py
  • Loading branch information
uriyyo committed Sep 21, 2021
commit 751baac9f892be98ed1bf6dd4f1c117d17ba2c71
11 changes: 11 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,17 @@ class P(Protocol):
def __init__(self, x: int):
self.x = x

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):

def test_basics(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ def _proto_hook(other):
if '__init__' in cls.__dict__:
raise TypeError('Protocols can not have __init__ method')

cls.__init__ = _no_init
cls.__init__ = _no_init_or_replace_init


class _AnnotatedAlias(_GenericAlias, _root=True):
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.