Python 2.0 naive question

Fredrik Lundh effbot at telia.com
Fri Sep 22 00:49:03 EDT 2000


David Bolen wrote:
> > Nope.  Old PYD files will pull in the wrong Python DLL,
> > which causes Python to crash.
> 
> Is there any chance at a succinct summary as to why this can't be
> fixed in 2.0 (not the incompatibility, but crashing rather than
> identifying the mismatch and raising an exception)?

The problem is that the PYD files contains the name of the Python
DLL they were linked against, so old PYDs will load the 1.5.2 DLL file,
and call the wrong version of Py_InitModule.  This DLL isn't properly
initialized, and Py_InitModule will crash.

Now, adding a sanity check to Py_InitModule is of course trivial,
but there is no such check in the 1.5.2 DLL...

In other words, to fix this, we either need to release a new 1.5.2
version and tell everyone to upgrade their 1.5.2 install before they
upgrade to 1.6/2.0 -- or we can change the module API to make
sure 1.5.2 PYDs doesn't load at all, and break every existing Python
extension...

The python-dev team decided that neither approach was worth the
effort, so we added a sanity check to the 2.0 DLL instead (not sure
if it made it into 1.6).  When you upgrade to 2.1, things will work
somewhat better...

</F>



More information about the Python-list mailing list