[Python-Dev] Re: C new-style classes and GC

Michael Hudson mwh@python.net
Tue, 20 May 2003 19:31:43 +0100


Tim Peters <tim.one@comcast.net> writes:

> [Tim]
>>> Micheal Hudson made a nice start in that direction, with 2.3's
>
> [Michael Hudson]
>> Hey, even Tims can't spell my name right!
>
> Are you sure it wasn't your parents who screwed up here <wink>? 

It would certainly be easier for the large fraction of the world who
aren't called Michael if it was spelled like that, but it ain't.  It
is remarkable just how often people do that though.

> I have a flu, and am lucky to spell anything write these dayz.  My
> apologies to you and your parents.

Heh, well I'm taking enough drugs to cope with my wisdom teeth today
you're lucky if I make sense never mind spell things right.

>>> It would be a good idea to add suitable redefinitions of
>>> PyMODINIT_FUNC 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
>
> Time's up.

I was clearly being optimistic here :-/

>> (a) the file then becomes misnamed (perhaps pyapicompat.h ...)
>
> Sounds good to me.
>
>> (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.
>
> A new pyapicompat.h could just #include the current pymemcompat.h and a new
> pywhatevercompat.h.  I'm not sure how easy the latter would be.  The new
>
>   PyAPI_FUNC(type)
>   PyAPI_DATA(type)
>   PyMODINIT_FUNC
>
> have snaky platform-dependent expansions, and were introduced because the
> older spellings were approximately incomprehensibly smushed together.  Since
> I don't know what to do offhand if I wanted to support multiple Pythons
> using the current API here, I have to guess most users won't either (for
> example, Jim's sample docs change the last one to plain void, which isn't
> always right); so if you do, I believe it would be a real help.

I thought the problem with DL_IMPORT/DL_EXPORT was that you wanted one
when statically linking and the other when dynamically linking.  But I
could be wrong.  pyapicompat.h could presumably import more or less
verbatim the whole preprocessory mess that defines PyAPI_FUNC in
Python today? AFAIK it doesn't depend on anything else from Python or
autoconf or so on.  Maybe.

Cheers,
M.

-- 
  NUTRIMAT:  That drink was individually tailored to meet your
             personal requirements for nutrition and pleasure.
    ARTHUR:  Ah.  So I'm a masochist on a diet am I?
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 9