clarete / forbiddenfruit

Patch built-in python objects
https://clarete.li/forbiddenfruit/
GNU General Public License v3.0
817 stars 52 forks source link

Cursing int with __iter__ fails with an error #51

Open toxicrecker opened 3 years ago

toxicrecker commented 3 years ago

Python 3.8.3

Code -

from forbiddenfruit import curse

def __iter__(self):
    return iter(range(self))

curse(int, "__iter__", __iter__)

Output -

forbiddenfruit/__init__.py", line 329, in _curse_special
    tp_as_name, impl_method = override_dict[attr]
KeyError: '__iter__'
RadiantUwU commented 2 years ago

This issue will be fixed once my pull request is accepted and merged, till then you can use the package from the pull request of mine with __iter__ integrated