On 2/16/21 11:50 AM, Андрей Казанцев wrote:
    It seems technically possible to override attributes/methods of
    built-in types, but the question is more if it's desirable?

The problem is that you cannot override the method not only in built-in types but also, for example, in `lxml.etree` classes. I wrote a module that changes the `type_setattro` method to mine, which does not have this check. And I'm wondering if there are any problems in this solution (in addition to philosophical ones) or everything will work as it should (and not as inheritance from built-in types).
Thank you for participating in the discussion.


As with built-in types, lxml.etree classes and all other static (i.e. non-heap) types are shared between all interpreters in a process. Changing them has the same issues as with built-in types.
The check for the Py_TPFLAGS_HEAPTYPE flag is correct.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/VITJX3QT2YG3AN5CY4FB7OP2VLSSP4UZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to