Q: PyErr_SetInterrupt, PyCrust
nfullagar
nfullagar at yahoo.com
Sun Dec 8 18:51:36 EST 2002
nfullagar at yahoo.com (nfullagar) wrote in message news:<29269de7.0212062103.4a5d286 at posting.google.com>...
> Hello Python Users,
>
> I've been playing around with Python (2.2.2), wxPython (2.3) and
> PyCrust (0.7.2) But if the user types "while 1: pass" in the scripting
> window, of course this brings down the whole application in an
> infinite loop. To make matters worse, windows blocks ctrl-break
> signals (unless you have an attached console... not something I want)
>
> To get around this, before calling python I set up a 2nd thread that
> puts up a tiny window with a button that if pressed calls
> PyErr_SetInterrupt().
Some more information... I can reproduce this now without any of my
code by running PyShell (comes with wxPython) and typing:
>>> import win32ui
>>> win32ui.CreateDebuggingThread()
The python icon appears in the lower right, and gives me the option to
break into running code. If PyShell is just sitting at the prompt,
and I break into running code, I get an access violation in ceval.c,
in function:
PyObject *
PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject
*locals,
PyObject **args, int argcount, PyObject **kws, int kwcount,
PyObject **defs, int defcount, PyObject *closure)
{
... a few lines down ...
for (i = 0; i < n; i++) {
x = args[i];
Access Violation--> Py_INCREF(x);
SETLOCAL(i, x);
}
At this point n == 2, i == 1, and args[i] == NULL
But if I do this from within PythonWin, I can click on "Break into
running code" all day long and it is fine. Before I go scouring the
sources, can anyone shed some light on what PythonWin does
differently? Is there some setup code that I'm missing (tried import
threading too, but same results)
BTW, this is on a dual CPU windows XP Pro machine. Haven't had a
chance to try a single CPU machine, but did try setting processor
affinity to 1 cpu with the same results (access violation)
Any info greatly appriciated, thanks -nicholas, a python newbie
More information about the Python-list
mailing list