Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Klattet opened this issue Jul 22, 2023 · 0 comments
Open

Comments

@Klattet
Copy link

Klattet commented Jul 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant