Hi, I'd like to bring back this discussion (from 2005, by Greg): https://bugs.python.org/issue1229239
Briefly, non-heap types cannot have their attributes changed by Python code. This makes sense for python builtin types, but not for the types defined in extension/modules. As we have been using this patch for the very same reasons and for more than 10 years, I think it might make sense to reconsider the discussion that Greg started. The main question at that time was "why not using a heap type instead ?" (because heap-type do not have this limitation). But I think that the right question could have been "why imposing such a restriction on non-heap types as defined in (non Python core) extensions ?". I mean, to my knowledge, there is no reason why a type should be allocated on the heap (https://docs.python.org/2/c-api/typeobj.html) to be able to change its attributes at Python level. I'm not saying that all non-heap types should be able to do so, just that it would make sense to allow this behavior, as an option (bit flag). At the implementation level, the changes needed are really limited (about a few lines): - Include/object.h - Objects/typeobject.c: Eloi _______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
