[Python-Dev] Avoiding reference leaks in heap types with custom tp_dealloc
Antoine Pitrou
solipsis at pitrou.net
Tue Jun 2 23:18:45 CEST 2015
On Tue, 2 Jun 2015 21:09:52 +0200
Petr Viktorin <encukou at gmail.com> wrote:
> On Mon, Jun 1, 2015 at 6:00 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> [...]
> > I think we have been laxist with additions to the stable ABI:
> > apparently, they should be conditioned on the API version requested by
> > the user. For example, in pystate.h:
> >
> > #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
> > /* New in 3.3 */
> > PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*);
> > PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*);
> > #endif
> >
> > (those were added by Martin, so I assume he knew what he was doing :-))
> >
> > This way, failing to restrict yourself to a given API version fails at
> > compile time, not at runtime. However, it's also more work to do so
> > when adding stuff, which is why we tend to skimp on it.
>
> I see! I completely missed that memo.
> I filed a patch that wraps my 3.5 additions as issue 24365.
>
> I think this should be in the PEP, so people like me can find it. Does
> the attached wording look good?
It looks good to me, but Martin should probably validate it. If he
hasn't answered yet in one month, perhaps you can add it anyway :)
Regards
Antoine.
More information about the Python-Dev
mailing list