[Python-Dev] Re: C new-style classes and GC (original) (raw)

Michael Hudson mwh@python.net
Tue, 20 May 2003 12:04:05 +0100


"Tim Peters" <tim@zope.com> writes:

Micheal Hudson made a nice start in that direction, with 2.3's

Hey, even Tims can't spell my name right!

Misc/pymemcompat.h

If you write your code to 2.3's simpler memory API, and #include that file, it will translate 2.3's spellings (via macros) into older spellings back through 1.5.2, keying off PYVERSIONHEX to choose the right renamings. Jim is doing something related by hand in these docs, via the unnecessary #ifndef PyMODINITFUNC /* declarations for DLL import/export */ #define PyMODINITFUNC void #endif blocks. That is, PyMODINITFUNC is defined (via Python.h) in 2.3, so the development docs shouldn't encourage pretending it may not be. It would be a good idea to add suitable redefinitions of PyMODINITFUNC to pymemcompat.h too, but whether someone will volunteer to do so is an open question.

Well, I could do this in a minute, but

(a) the file then becomes misnamed (perhaps pyapicompat.h ...)

(b) I suspect some fraction of the value of pymemcompat.h is that it is short and has just-less-than abusive guidance on which memory API functions to use.

Cheers, M.

-- ARTHUR: Ford, you're turning into a penguin, stop it. -- The Hitch-Hikers Guide to the Galaxy, Episode 2