[Python-Dev] Name clash with typedefs in object.h

Guido van Rossum guido@python.org
Tue, 15 Jan 2002 10:35:11 -0500


> Object.h declares various typedefs for routine pointers, and their names are 
> not adorned with some sort of Py_ prefix.
> 
> Suddenly this has started to be a problem for me on OSX (not sure
> why: either object.h changed or because I got a new version of the
> OSX devtools): object.h declares a typedef "destructor", and if that
> is in scope when <pthread.h> is included this fails, which uses the
> name "destructor" as an argument name (for a routine pointer), and
> the parser gets confused.

destructor is a very old typedef, so OSX must've changed. :-)

> I think it's GCC that's to blame here, but still: shouldn't these
> names have some sort of a prefix?

Looking back, yes, definitely.  They were overlooked by the "grand
renaming" because they aren't visible to the loader.  But hard to fix
-- these typedefs are used in 3rd party extensions all over the place.

> Alternatively I can apply a quick fix by defining "destructor" as
> something else just before including <pthread.h>...

That sounds like the right fix, but please do it inside a platform
#ifdef.  I believe typedef names are exported as gdb symbols, but CPP
#defines are not.

--Guido van Rossum (home page: http://www.python.org/~guido/)