Skip to content

__init_subclass__ seems to not be implemented as a cursable magic method #74

Description

@Klattet
from forbiddenfruit import curse

def test(*args, **kwargs):
    ...

curse(object, "__init_subclass__", test)

Raises the error

Traceback (most recent call last):
  File "/Users/Lexion/Code/Monkeypatching/main.py", line 9, in <module>
    curse(object, "__init_subclass__", test)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/forbiddenfruit/__init__.py", line 426, in curse
    _curse_special(klass, attr, value)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/forbiddenfruit/__init__.py", line 333, in _curse_special
    tp_as_name, impl_method = override_dict[attr]
                              ~~~~~~~~~~~~~^^^^^^
KeyError: '__init_subclass__'

because __init_subclass__ is not in the override dictionary

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions