On 2008-12-10 21:05, Adam Olsen wrote: > On Wed, Dec 10, 2008 at 12:22 PM, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: >> One thing i think it would be useful for in the real world is for >> unittesting extension modules. You cant profitably write unit tests >> for segfaults because that breaks the test harness. In situations like >> those, recovering would be likely (caveat emptor of course). > > The only safe option there is a subprocess.
True, but that still makes it a little difficult to report the errors found in the module. mxTools has an optional safecall() function that allows calling functions which potentially segfault and still returns control back to the calling application: http://www.egenix.com/products/python/mxBase/mxTools/ It's not (yet) documented, but fairly straight forward to use once you've enabled it in egenix_mx_base.py: result = mx.Tools.safecall(callable, args, kws) Using such a function is handy in situations where you have a multi-process application setup that sometimes needs to call out to external libraries of varying quality - a situation that's not uncommon in real-life situations. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Dec 10 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