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
Tracing a class that defines a custom __class__ appears to remove said property under certain circumstances
#98148
Comments
|
I'm going to comment here, because PyPy managed to follow CPython closely enough that we have exactly the same bug. slowly getting a clue about what is happening with this bug. Some (somewhat unorganized) notes:
This is my current understanding how the buggy behavior happens. I don't have a clear idea how to fix this yet though. Some tentative ideas:
The disassembled bytecode of the example code in 3.10 |
|
ah, of course a slightly simpler way to produce the bug is to call class FancyFoo2:
def bug(self):
__class__
__class__ = 12
print(locals())
print(FancyFoo2.__dict__['__class__'])produces: |
ionelmc commentedOct 10, 2022
Tested on 3.7, 3.8, 3.9 and 3.10
It appears that using
super()in the class makes the class behave differently when traced:Remove either the
def bugor thesettracecall and the assertion passes.Ref nedbat/coveragepy#1382.
The text was updated successfully, but these errors were encountered: