Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
If a slot ID is repeated inPyType_Spec, the currentPyType_FromSpec implementation happens tousually use the last one and ignore earlier ones, but:
- if
Py_tp_docis repeated,PyType_FromSpecmay leak memory, and - if
Py_tp_membersis repeated,PyType_FromSpecmay memcpy unintialized memory (if slot specifies fewer members than the last one).
We chould:
- clarify in the docs that repeated slot IDs are not supported
- raise an exception for duplicate slots (at least when it's easy to detect, as in the cases above)
Alternatively, we could formalize that the last slot of a given ID “wins” and fix the leak/mem issue, but I don't see a use case for this more complex behavior.