[Stackless] Basic stackless embedding
Andrew Macentire
amacentire at ymail.com
Mon Jan 17 17:18:21 CET 2011
Hello! I'm new to the field and I was trying a simple stackless embedding test and experienced problems.Here is the short source code to my test:
#include <stackless_api.h>
#include <windows.h>
int main(void)
{
PyInterpreterState* pys;
Py_Initialize();
PyRun_SimpleString("import stackless");
PyRun_SimpleString("print stackless.runcount");
PyRun_SimpleString("print stackless.getcurrent()");
PyObject *task;
task=PyStackless_GetCurrent(); // <==== CRASH HERE
Py_DECREF(task);
return 1;
}
I am using MSVC 8 and an unmodified distribution of Python 2.7.1 Stackless 3.1b3 060516,
built with the same compiler.
The crash happens inside PyStackless_GetCurrent, which looks like this:
PyObject *
PyStackless_GetCurrent(void)
{
PyThreadState *ts = PyThreadState_GET();
PyObject *t = (PyObject*)ts->st.current;
Py_INCREF(t);
return t;
}
The crash happens on Py_INCREF(t), because the thread state object returned by PyThreadState_GET
doesn't seem to be properly initialized.
I'm probably missing something very basic, but any help is appreciated.
Cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20110117/de14119a/attachment.html>
More information about the Stackless
mailing list