Have you considered my suggested consenting-adult approach of limiting the recursion to only the subordinates of an object being frozen to make the proposal a lot less prone to freezing unintended objects?
It’s hard for me to imagine how a proxy approach can work when a proxy object cannot possibly be of the same type as the actual object. It may be able to behave like the actual object, but it will fail if its exact type is checked on or if direct access to a slot of the actual object is needed.
Thanks for the POC. I haven’t spent time looking into the implementation, but can you quickly brief me at a high level on how for example a proxy dict can work with, say, PyDict_GetItem? Does PyDict_GetItem need to be modified such that it will obtain the actual object first if it finds that the object passed in is a proxy?