Skip to content

Commit

Permalink
Fix crash when __init__ is assigned to
Browse files Browse the repository at this point in the history
Fixes #488
  • Loading branch information
AWhetter committed Oct 26, 2024
1 parent 0e9bb9b commit eb2d7f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autoapi/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,9 @@ def classes(self):
def constructor(self):
for child in self.children:
if child.short_name == "__init__":
if not child.type == "method":
break

return child

return None
Expand Down
1 change: 1 addition & 0 deletions docs/changes/488.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash when __init__ is assigned to
4 changes: 4 additions & 0 deletions tests/python/pyexample/example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class Two(One):
"""Two."""


class Three:
__init__ = Two.__init__


def fn_with_long_sig(
this,
*,
Expand Down

0 comments on commit eb2d7f2

Please sign in to comment.