[Python-Dev] Python 2.3 release schedule

Neil Schemenauer nas@python.ca
Tue, 28 May 2002 08:01:49 -0700

Michael Hudson wrote:
> I was under the impression that the 2.1 and 2.2 interfaces differed in
> ways that couldn't easily be papered over with macros.  I'll check.

It's not pretty.  Look at pyexpat.c for an example.  Perhaps something
like this would be good enough (untested):

#if PY_VERSION_HEX < 0x020200B1
#define PyObject_GC_New         PyObject_New
#define PyObject_GC_NewVar      PyObject_NewVar
#define PyObject_GC_Del         PyObject_Del
#define PyObject_GC_Track(op)
#define PyObject_GC_UnTrack(op)

People could then always use the 2.2 API but the objects would only be
collected in versions >= 2.2.  Using the 2.1 API is a fair bit trickier
and you can't hide those differences using macros (although you could
make it easier for people who want to support 2.1 and >=2.2).