A modest Error (I mean Proposal)
Arinte
shouldbe at message.com
Fri Jan 21 08:23:19 EST 2000
You'll have to excuse me because, I am a newbie to python and I don't do a
lot of doc reading.
This is a embedded python project, lots of calls back and forth from c++ to
python. How do you know when to call PyErr_Clear? Do I call it when I do a
rets = PyLong_AsLong(comm);
when comm is suppose to be a string? I do this, because I don't know how to
type check the PyObjects in C/c++. I know it is in there somewhere, but I
was trying to be quick and it is like which ever one isn't null will be the
one I use.
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:000901bf6405$f7692360$f29b12c2 at secret.pythonware.com...
[snip]
is this the entire program, or are any user-written
C extensions involved in this?
a great way to get utterly weird errors is to have
a C extension function which ignores an internal
exception, but returns to Python without clearing
the error state (PyErr_Clear).
if you cannot fix the C code, you can clear the
error state from Python, using something like:
mymodule.badfunction()
hasattr(None, "none")
just after the C call.
</F>
More information about the Python-list
mailing list