"Fred L. Drake, Jr." wrote: > > M.-A. Lemburg writes: > > Another issue: importing old extensions now causes a core dump > > due to the new slots for weak refs beind written to. > > I think(!) this should only affect really modules from 1.5.? and > earlier; type objects compiled after tp_xxx7/tp_xxx8 were added > *should not* have a problem with this. You don't give enough > information for me to be sure. Please let me know more if I'm wrong > (possible!). I've only tested these using my mx tools compiled against 1.5 -- really old, I know, but I still actively use that version. tp_xxx7/8 were added in Python 1.5.2, I think, so writing to them causes the core dump. > The only way I can see that there would be a problem like this is if > the type object contains a positive value for the tp_weaklistoffset > field (formerly tp_xxx8). > > > Solution: in addition to printing a warning, the _PyModule_Init() > > APIs should ignore all modules having an API level < 1010. > > For the specific problem you mention, we could add a type flag > (Py_TPFLAGS_HAVE_WEAKREFS) that could be tested; it would be set in > Py_TPFLAGS_DEFAULT. That would work, but is it really worth it ? The APIs have changed considerably, so the fact that I got away with a warning in Python2.0 doesn't really mean anything -- I do have a problem now, though, since maintaining versions for 1.5, 1.5.2, 2.0 and 2.1 will be a pain :-/ > On the other hand, I'd be perfectly happy to "ignore" modules with > the older C API version (especially if "ignore" lets me call > Py_FatalError()!). The API version changed because of the changes to > the function signatures of PyCode_New() and PyFrame_New(); these both > require additional parameters in API version 1010. Py_FatalError() is a bit too harsh, I guess. Wouldn't it suffice to raise an ImportError exception and have Py_InitModule() return NULL in case a module with an incompatible API version is encountered ? BTW, what happened to the same problem on Windows ? Do users still get a seg fault ? -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4