Terry Reedy wrote: > > The following was posted in the last 25 hours on c.l.p: > > "Xaver Hinterhuber" <xaver_hinterhuber at web.de> wrote in message > news:c7o6al$i1j$1 at online.de... > > codeObject = new.code( > > 0, # argcount > > 0, # nlocals > > 0, # stacksize > > 0, # flags > > codeString, # code > > (), # consts > > (), # names > > (), # varnames > > 'content', # filename > > 'content', # name > > 3, # first line number > > codeString # lnotab > > ) > > f = new.function(codeObject, dict, 'f') > > f() > > > > Everything runs fine, until the function is called with f(). > > When python tries to execute f(), the core dump happens. > > I don't have any clue why python core dumps. > > The codeString is nothing complex, its a one-liner. > > ... but, as too typical of new posters, not posted ;-) > > My question: I understand that core dumping by the Python > interpreter is > normally considered a bug -- one that should be reported on SF -- and > fixed. But does that principle apply to this sort of use (or probably > abuse) of the new module. In other words, does the 'no core > dump' contract > include a 'byte code compiled by the interpreter' proviso. > Or is ceval > intended to be robust against random strings masquerading as > valid byte > code (which would seem require an InvalidByteCode exception). > Or in still > other words, is there a bug that I should encourage reporting > of, or is > 'don't do that' the extent of a proper response? There are other problems; once I passed a unicode string in co_names--it took me quite a while to track down THAT mistake. :) Perhaps some more rigorous assertions, returning ValueErrors? If not in C, then in the 'new' module, since that seems to be the vector of disaster for Xaver, above. Perhaps this would also be an argument for keeping the 'new' module around longer, as a 'safer' Pythonic wrapper over bare code/function construction. Robert Brewer MIS Amor Ministries fumanchu at amor.org
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