curse error
Cologler opened this issue · 3 comments
Cologler commented
import forbiddenfruit
forbiddenfruit.curse(str, 'first', lambda x: x[0])
'123'.first() # '1'
is Okay. But if you try:
import forbiddenfruit
hasattr(str, 'first')
forbiddenfruit.curse(str, 'first', lambda x: x[0])
'123'.first() # raise AttributeError
Any patch for this?
Cologler commented
fixes by insert a line:
import forbiddenfruit
import ctypes
hasattr(str, 'first')
forbiddenfruit.curse(str, 'first', lambda x: x[0])
ctypes.pythonapi.PyType_Modified(ctypes.py_object(str))
'123'.first()
clarete commented
That's such an interesting bug. I'll take a look! Thanks for mentioning the workaround! <o/
Cologler commented
I just make a PR (base on your pyenv-versions) and all tests pass.