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
__setitem__ for __dict__ ignored #40821
Comments
In python 2.3.3 this code cause assertion: class d(dict):
_is_setted = None
def __setitem__(self, k, v):
self._is_setted = 1
class test:
def __init__(self):
self.__dict__ = d()
t = test()
t.x = 2
assert t.__dict__._is_setted == 1, 'no `__setitem__` calls' |
Logged In: YES Underneath the hood, test's setattr is accessing the While this one is fixable, I'm not sure it's really a bug. In any case, I would not have expected old style classes For the use cases modeled after the OP's code, overiding |
Logged In: YES I agree with Raymond. I think this pretty much the design Viktor, if you disagree, you might try discussing this on |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: