[Stackless] Python, C, context-switching

Lars Immisch lars at ibp.de
Wed Sep 29 10:30:53 CEST 2004

Hi Joel,

> #0  0x0810202c in PyFrame_New (tstate=0x0, code=0x402ea7a0,    
> globals=0x402aa41c, locals=0x0) at Objects/frameobject.c:569
> #1  0x080aa708 in PyEval_EvalCodeEx (co=0x402ea7a0, globals=0x402aa41c, 
>    locals=0x0, args=0x402f64f8, argcount=1, kws=0x0, kwcount=0, 
> defs=0x0,    defcount=0, closure=0x0) at Python/ceval.c:2698
> #2  0x081043a0 in function_call (func=0x402f0844, arg=0x402f64ec, kw=0x0)
>    at Objects/funcobject.c:506
> #3  0x0805cdd9 in PyObject_Call (func=0x402f0844, arg=0x402aa41c,    
> kw=0x402aa41c) at Objects/abstract.c:1757
> #4  0x08063844 in instancemethod_call (func=0x402f0844, arg=0x402f64ec, 
>    kw=0x402aa41c) at Objects/classobject.c:2454
> #5  0x0805cdd9 in PyObject_Call (func=0x402f7bbc, arg=0x402aa41c,    
> kw=0x402aa41c) at Objects/abstract.c:1757
> #6  0x080ab978 in PyEval_CallObjectWithKeywords (func=0x402aa41c,    
> arg=0x4029d02c, kw=0x402f7bbc) at Python/ceval.c:3619
> #7  0x0805cd7e in PyObject_CallObject (o=0x402aa41c, a=0x402aa41c)
>    at Objects/abstract.c:1747

Hmmm. The tstate=0x0 looks fishy (after admittedly only a cursory glance).

Does your SWIG glue code that invokes the callbacks acquire and release 
the Global Interpreter lock?

Be aware that SWIG does not help you with there automatically.

See http://www.python.org/doc/2.3.4/api/threads.html for some background.

BTW, this advice does not really take stackless into account.

- Lars
- Lars

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list