Benjamin wrote:
There's a wonderful comment about this in typeobject.c:
This is basically the same what I've gathered from the issue description which was quite helpful. But in this case we're dealing with mutating the type object and changing whether __new__ or __init__ exist at all at runtime - and object.__new__/__init__ don't seem to be picking up on the change. I believe that the comments here w.r.t. mutability/immutability are more about whether the instances are immutable and not the type objects themselves - for example list vs tuple where tuple has __new__ but no __init__. Based upon the behavior I'm seeing it seems to me that the presence of __new__ / __init__ must be getting cached somewhere and the deletion isn't updating the cache and that's specifically what struck me as odd here.