[ZODB-Dev] Latest news: core dump with small change to POSException.py

Jeremy Hylton jeremy@zope.com
Tue, 25 Sep 2001 19:04:00 -0400 (EDT)


Well, I'm puzzled.  I'll have to look at it again tomorrow.

If you edit testConflict.py like so:

    if should_fail:
        try:
            merged=o1._p_resolveConflict(s1, s2, s3)
##        except:
        except ConflictError, err:
            pass # cool
        else:
            assert 0, message

You don't get a segfault.  You just get a regular exception.

One of the problems is that _p_resolveConflict() is C code that raises
a ConflictError and passes it four arguments.  When the exception is
actually caught in the interpreter and turned into an exception
object, the call to ConflictError raises a TypeError.  After your
patch, ConflictError only takes one argument, but it's called with
four.  PyErr_NormalizeException() returnes normally, but with the bare
except it dumps core.

always-knew-there-were-good-reasons-to-avoid-bare-excepts-ly y'rs,
Jeremy