Message401642
| Author |
mattip |
| Recipients |
Alexander.Belopolsky, Arfrever, Robin.Schreiber, amaury.forgeotdarc, belopolsky, jcea, jhaberman, lekma, loewis, mattip, petr.viktorin, pitrou |
| Date |
2021年09月11日.16:55:03 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1631379303.59.0.239783914379.issue15870@roundup.psfhosted.org> |
| In-reply-to |
| Content |
>> 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" |
|
History
|
|---|
| 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 |
|