On 2008-12-11 19:15, Adam Olsen wrote: > On Thu, Dec 11, 2008 at 2:34 AM, Victor Stinner > <victor.stin...@haypocalc.com> wrote: >> Le Wednesday 10 December 2008 20:04:00 Terry Reedy, vous avez écrit : >>>>> Recover after a segfault is dangerous, but my first goal was to get the >>>>> Python backtrace instead just one line: "Segmentation fault". It helps a >>>>> lot for debug! >>>> Exactly! That's why it doesn't belong in the Python core. We can't >>>> guarantee anything about its affects or encourage it. >>> Would it be safe to catch SIGSEGV, output a trace, and then exit? >>> IE, make the 'first goal' the only goal? >> Oh yeah, good idea :-) Does it mean that Python interpreter can't be used to >> display the trace? It would be nice to -at least- use the Python stderr >> (which is written in pure Python for Python3). It would be better if the user >> can setup a callback, like sys.excepthook. But if -as many people wrote- >> Python is totally broken after a segfault, it is maybe not a good idea :-) > > You have to use the low-level stderr, nothing that invokes Python. > I'd hate to get a second segfault while printing the first. > > Just think about how indirect refcounting bugs tend to be. Another > example is messing up GIL handling. There's heaps of things for which > we'd want good stack traces, which can't be done from Python.
Experience with mx.Tools.safecall() shows that there's a lot you can still do after a segfault in some library, including print the traceback in Python, so things are not as bad. However, I'd disable such functionality in Python per default, if it should ever get introduced. This has got to stay an expert option, unless we want to risk messing up user systems completely, e.g. by having some logging manager unintentionally overwrite important files on the disk. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Dec 11 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2008-12-02: Released mxODBC.Connect 1.0.0 http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com