Message401642
>> 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" |
|
Date |
User |
Action |
Args |
2021-09-11 16:55:03 | mattip | set | recipients:
+ mattip, loewis, jcea, amaury.forgeotdarc, belopolsky, pitrou, Arfrever, petr.viktorin, lekma, Alexander.Belopolsky, Robin.Schreiber, jhaberman |
2021-09-11 16:55:03 | mattip | set | messageid: <1631379303.59.0.239783914379.issue15870@roundup.psfhosted.org> |
2021-09-11 16:55:03 | mattip | link | issue15870 messages |
2021-09-11 16:55:03 | mattip | create | |
|