[Python-Dev] Patch to avoid conflict with older versions of Python.

Thomas Heller thomas.heller@ion-tof.com
Fri, 29 Sep 2000 09:36:33 +0200


> Hi all,
> I'd like some feedback on a patch assigned to me.  It is designed to
> prevent Python extensions built for an earlier version of Python from
> crashing the new version.
>
> I haven't actually tested the patch, but I am sure it works as advertised
> (who is db31 anyway?).
>
> My question relates more to the "style" - the patch locates the new .pyd's
> address in memory, and parses through the MS PE/COFF format, locating the
> import table.  If then scans the import table looking for Pythonxx.dll,
and
> compares any found entries with the current version.
Shouldn't the win32 api BindImageEx be used? Then you would not have
to know about the PE/COFF format at all. You can install a callback
function which will be called with the dll-names bound.
According to my docs, BindImageEx may not be included in early versions of
Win95, but who is using that anyway?
(Well, ok, what about CE?)

>
> Quite clever - a definite plus is that is should work for all old and
> future versions (of Python - dunno about Windows ;-) - but do we want this
> sort of code in Python?  Is this sort of hack, however clever, going to
> some back and bite us?
>
> Second related question:  if people like it, is this feature something we
> can squeeze in for 2.0?
+1 from me (if I count).

>
> If there are no objections to any of this, I am happy to test it and check
> it in - but am not confident of doing so without some feedback.
>
> Thanks,
>
> Mark.

Thomas