[Python-Dev] Inconsistency of PyModule_AddObject()
Serhiy Storchaka
storchaka at gmail.com
Wed Apr 27 14:06:25 EDT 2016
More information about the Python-Dev mailing list
Wed Apr 27 14:06:25 EDT 2016
- Previous message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Next message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 27.04.16 16:08, Nick Coghlan wrote: > On 27 April 2016 at 17:14, Serhiy Storchaka <storchaka at gmail.com> wrote: >> I think that we can resolve this issue by following steps: >> >> 1. Add a new function PyModule_AddObject2(), that steals a reference even on >> failure. > > I'd suggest a variant on this that more closely matches the > PyList_SetItem and PyTuple_SetItem cases: PyModule_SetAttrString > > The first two match the signature of PySequence_SetItem, but steal the > reference instead of making a new one, and the same relationship would > exist between PyObject_SetAttrString and the new > PyModule_SetAttrString. I think it is better to have relation with PyModule_AddIntConstant() etc than with PyObject_SetAttrString. My patch doesn't introduce new public function, but changes the behavior of the old function. This needs minimal changes to user code that mostly use PyModule_AddObject() incorrectly (not blaming authors).
- Previous message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Next message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list