Message318493
There is another catch that belongs in the same category.
There is line 2841 in typeobject.c
if (type->tp_dealloc == NULL) {
/* It's a heap type, so needs the heap types' dealloc.
subtype_dealloc will call the base type's tp_dealloc, if
necessary. */
type->tp_dealloc = subtype_dealloc;
}
When converting the PySide types, it became a real problem. Types with an
existing tp_dealloc behaved normal, but those with tp_dealloc=NULL
gave segfaults. I ended up supplying a default dummy_dealloc()
that is just there to occupy this slot. Then it worked.
And another source of incompatibility:
PyType_FromSpec() enforces a tp_name field to be dotted, to compute a module
name. Very annoying incompatibility that could be avoided.
A small but remarkable glitch:
Most fields of the PyType_Spec/PyType_Slot combo are copied, but some are not.
So expect funny behaviour when creating types with dynamically generated
specs without strdup. That should IMHO be changed. |
|
| Date |
User |
Action |
Args |
| 2018-06-02 10:30:09 | Christian.Tismer | set | recipients:
+ Christian.Tismer, loewis, ncoghlan, petr.viktorin, docs@python, serhiy.storchaka, Dormouse759 |
| 2018-06-02 10:30:09 | Christian.Tismer | set | messageid: <[email protected]> |
| 2018-06-02 10:30:09 | Christian.Tismer | link | issue26979 messages |
| 2018-06-02 10:30:08 | Christian.Tismer | create | |
|