version independant object usage counting

Martin v. Löwis loewis at
Mon Sep 2 12:26:32 EDT 2002

"Rolf Kalbermatter" <rolf.kalbermatter at> writes:

> > That is only a minor problem: those macros are correct across all
> > released Python versions, back to 1.4 or earlier.
> But there is a serious difference between the DEBUG and NON-DEBUG
> PyObject_HEAD structure layout which I would like to not have to worry
> about if possible. 

I see.

> Does anyone see any problems with this code?

Looks fine.

> >   * PyObject_INIT relies on initializing the object members.
> > - PyType_HasFeature relies on the position of the tp_flags field
> I'm not using these function at all until now. May have to do so when
> I start to add an extension module however?

You might be using HasFeature implicitly, e.g. in PyIter_Check, or
PyType_IS_GC. You might be using PyObject_INIT if you define types.

In short, I agree with you that it is desirable to have function
versions of everything that implies knowledge about the layout -
however, as soon as you start extension modules (e.g. sre, socket),
you will find that you require a specific version of the pythonxy.dll,


More information about the Python-list mailing list