Upgrading Python Breaks Extensions; Fix proposal

Robin Becker robin at jessikat.fsnet.co.uk
Wed Aug 29 10:30:39 CEST 2001


In Tcl land, these problems caused the powers that be to implement their
own indirection scheme. Effectively the extension is passed a pointer to
a list of pointers. The extension indirects through them to get at the
real api. They have various rules to make things work reasonably when
pointers get added/subtracted to the real API. Seems to work quite well,
but there's a fixed time and space penalty.

The windows problem comes because the name of the main Python dll is
embedded in the extension. I've never been too sure exactly how linking
takes place with win32, probably because the dll idea changed between
traditional windows and win32.

One possible way to extend the life of an API compatible extension would
be to use an intermediate stub proxy for the original python dll. So the
extension

X.pyd links to Python20.dll

Python21.dll is issued along with a stub proxy for all of the 20 API
points this is called naturally enough Python20.dll, but would really be
an indirection vector.

then X.pyd links to Python20.dll (proxy) which links to Python21.dll.

Of course this scheme would get terribly confusing and awful as soon as
newer Pythonxx.dlls appear (alongside their own proxies). Perhaps the
proxy could be made smart enough to search out and link itself to the
available Python API.
-just adding to DLL hell-ly yrs- 
Robin Becker



More information about the Python-list mailing list