Patch to avoid conflict with older versions of Python.
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. 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? 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.
Hi all, I'd like some feedback on a patch assigned to me.
sorry - http://sourceforge.net/patch/?func=detailpatch&patch_id=101676&group_id=547 0 Mark.
[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
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
According to my docs, BindImageEx may not be included in early versions of Win95, but who is using that anyway?
lots of people -- the first version of our PythonWare installer didn't run on the original Win95 release, and we still get complaints about that. on the other hand, it's not that hard to use BindImageEx only if it exists... </F>
According to my docs, BindImageEx may not be included in early versions of Win95, but who is using that anyway?
lots of people -- the first version of our PythonWare installer didn't run on the original Win95 release, and we still get complaints about that.
Requirements Windows NT/2000: Requires Windows NT 4.0 or later. Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Header: Declared in Imagehlp.h. Library: Use Imagehlp.lib.
on the other hand, it's not that hard to use BindImageEx only if it exists...
Thomas
[Thomas Heller]
According to my docs, BindImageEx may not be included in early versions of Win95, but who is using that anyway?
[/F]
lots of people -- the first version of our PythonWare installer didn't run on the original Win95 release, and we still get complaints about that.
Indeed, you got one from me <wink>!
on the other hand, it's not that hard to use BindImageEx only if it exists...
I'm *really* going on vacation now, but if BindImageEx makes sense here (offhand I confess the intended use of it here didn't click for me), MS's imagehlp.dll is redistributable -- although it appears they split it into two DLLs for Win2K and made only "the other one" redistributable there <arghghghgh> ...
I'm *really* going on vacation now, but if BindImageEx makes sense here (offhand I confess the intended use of it here didn't click for me), MS's imagehlp.dll is redistributable -- although it appears they split it into two DLLs for Win2K and made only "the other one" redistributable there <arghghghgh> ...
No need to install it on Win2K (may not even be possible?), only for Win95. I just checked: imagehlp.dll is NOT included in Win95b (which I still use on one computer, but I thought I was in a small minority) Thomas
I still think that Python needs to fix the problem with the API between the core and the extensions. That way all the version checking would work for Windows and Unix. But since that approach has been rejected I'd take any change to python that reduces support calls. BArry
-----Original Message----- From: python-dev-admin@python.org [mailto:python-dev-admin@python.org]On Behalf Of Mark Hammond Sent: 29 September 2000 02:36 To: python-dev@python.org Subject: [Python-Dev] Patch to avoid conflict with older versions of Python.
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.
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?
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.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://www.python.org/mailman/listinfo/python-dev
participants (5)
-
Barry Scott
-
Fredrik Lundh
-
Mark Hammond
-
Thomas Heller
-
Tim Peters