Skip to content

Magic methods not cursing the word itself #83

Description

@alacritous13
from forbiddenfruit import curse, reverse

def bob(self,ted):#{
    return self[0] + ted[0];
#}
curse(type([1,2,3]),"__add__",bob)

v1=[2,3,4];
v2=[5,2,3];

print(v1 + v2)
print(v1.__add__(v2))

In the above code, I expect both instances of print to generate the same results, and they do if I remove the curse function (both uncursed). As is, only the first instance (v1 + v2) is properly cursed, where's the second instance continues to function according to its uncursed state despite being the actual text that was used in the cursing process.

Testing primarily on Python 3.11.5, but also did a quick test on 3.12 with a variable other than list.

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