En Wed, 24 Dec 2008 15:48:34 -0200, Gabriel Genellina <gagsl-...@yahoo.com.ar> escribió:

En Wed, 24 Dec 2008 15:00:36 -0200, Ivan Illarionov <ivan.illario...@gmail.com> escribió:

When you raise an exception in C++ you can set it to ANY Python object
via PyErr_SetObject and that object could store pointers to C++
classes.

Remember that exceptions should inherit from BaseException; although this rule isn't enforced in Python 2.6, 3.0 doesn't allow that. It isn't explicitely written in the docs, but I think that PyErr_SetObject won't allow you to pass an object which is not an instance of its first argument.

Correction: you're right, it is OK to pass any other object as the second parameter to PyErr_SetObject; it will be used as the argument to the exception constructor.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to