PyErr_SetString crashes.

alantdaniels at my-deja.com alantdaniels at my-deja.com
Fri Aug 25 09:18:18 EDT 2000


Hi folks:

I'm attempting to embed Python into a Borland C++ Builder app. I've
been able to do all the cool things such as create of a module with an
actual Python class definition in it and such, and it works fine
except for one thing: Whenever I make *any* call to set a Python
exception, the app crashes right then and there.

I haven't been able to find anything in the docs on this, and I'm
currently going through all the original Python source code to try to
see what I'm doing wrong, but I was wondering if anyone had seen this
before. Here's a simple app that duplicates the problem:

  #include <python.h>

  int main(int, char**)
  {
    PyObject *globals;

    Py_Initialize();
    globals = PyDict_New();
    PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins());

    PyErr_SetString(PyExc_ImportError, "Kaboom!");

    Py_Finalize();
    return 0;
  }

As soon as I call "PyErr_SetString", the entire app crashes. Also, it
crashes even if I skip the creation of a global dictionary with the
builtins. If anybody can help I'd appreciate it.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list