clarete / forbiddenfruit

Patch built-in python objects

Home Page:https://clarete.li/forbiddenfruit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cursing int with __iter__ fails with an error

toxicrecker opened this issue · comments

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__'

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