PyRun_String does not appear to handle EInvalidOp exceptions

Heather Korns hrkorns at ccr.net
Mon Jun 6 18:27:02 EDT 2005


Here's a snippet of code that demonstrates my problem:

  result = PyRun_String ("import math", Py_file_input, pdict,pdict);
  result = PyRun_String ("math.sqrt(-1)", Py_file_input, pdict,pdict);
  result = PyRun_String ("math.pow(2,1024)", Py_file_input,
pdict,pdict);


Other types of exceptions seem to be handled properly by PyRun_String;
however, EInvalidOp or EOverflow exceptions do not seem to be handled.
My application is unable to recover gracefully after this exception
occurs.

Has anyone else run into this problem?

Thanks.




More information about the Python-list mailing list