mattip <matti.pi...@gmail.com> added the comment:
>> I wouldn't recommend [setting ob_type] after PyType_Ready is called. > Why not? What bad things will happen? It seems to be working so far. It breaks the unwritten contract that "once PyType_Ready is called, the C struct will not be modified". This is implemented in PyPy, since calling PyType_Ready creates the PyPy object in the interpreter based on the C structure. Any further changes will not be reflected in the PyPy interpreter object, so now the python-level and c-level objects do not agree what type(obj) is. We have discussed this in the PyPy team, and would like to propose relaxing the contract to state that "if the c-level contents of an object are modified, PyType_Modified must be called to re-synce the python level and c-level objects" ---------- nosy: +mattip _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue15870> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com