
[Mark Hammond]
I'd like some feedback on a patch assigned to me.
It's assigned to you only because I'm on vacation now <wink>.
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?).
It's sure odd that SF doesn't know! It's David Bolen; see http://www.python.org/pipermail/python-list/2000-September/119081.html
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.
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?
Guido will hate it: his general rule is that he doesn't want code he couldn't personally repair if needed, and this code is from Pluto (I hear that's right next to Redmond, though, so let's not overreact either <wink>). OTOH, Python goes to extreme lengths to prevent crashes, and my reading of early c.l.py reports is that the 2.0 DLL incompatibility is going to cause a lot of crashes out in the field. People generally don't know squat about the extension modules they're using -- or sometimes even that they *are* using some.
Second related question: if people like it, is this feature something we can squeeze in for 2.0?
Well, it's useless if we don't. That is, we should bite the bullet and come up with a principled solution, even if that means extension writers have to add a few new lines of code or be shunned from the community forever. But that won't happen for 2.0.
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.
Guido's out of touch, but I'm on vacation, so he can't yell at me for encouraging you on my own time. If it works, I would check it in with the understanding that we earnestly intend to do whatever it takes to get rid of this code after 2.0. It is not a long-term solution, but if it works it's a very expedient hack. Hacks suck for us, but letting Python blow up sucks for users. So long as I'm on vacation, I side with the users <0.9 wink>. then-let's-ask-david-to-figure-out-how-to-disable-norton-antivirus-ly y'rs - tim