[Python-Dev] Need advice, maybe support

Christian Tismer tismer@tismer.com
Sat, 24 May 2003 00:54:24 +0200


Thomas Heller wrote:
>>>>The other is the new style where the PyMethodDef
>>>>array is in tp_methods, and is scanned once by PyType_Ready.
>>>
>>>Right, again. Now, under the hopeful assumption that every
>>>sensible extension module that has some types to publish also
>>>does this through its module dictionary, I would have the
>>>opportunity to cause PyType_Ready being called early enough
>>>to modify the method table, before any of its methods is used
>>>at all.
>>
>>Dangerous assumption!  It's not inconceivable that a class would
>>instantiate some of its own classes as part of its module
>>initialization.

First time that I saw this.
I do agree that it is possible to break every compatibility
scheme. Especially in your module's case, I would not assume
that anybody would consider not to use the most recent version
and compile it against the most recent sources?
The topic I'm talking about is old code which should continue
to run.

> I do not really know what you are talking about here, but that
> assumption is violated by the ctypes module.
> It has a number of metaclasses implemented in C, neither of them
> is exposed in the module dictionary, and there *have been* types which
> were not exposed, because they are only used internally.

Hmm. Ok. Then I am really intersted if you have an idea,
how to solve this efficiently.
My current solution is augmenting method tables by sibling
elements, which is a) not nice and b) involves extra flags
in ml_flags, which is not as efficient as possible.
Martin proposed to grow a second method table and to maintain
it in parallel. This is possible, but also seems to involve
quite some runtime overhead. What I'm seeking for is a place
that gives a secure solution, without involving code that
is executed, frequently.

On the other hand, this issue is about *most* foreign, old
code. I think I could stand if the one or the other module
simply requires to be re-compiled with the current stackless
version, if this doesn't mean to re-compile everything.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/