[Stackless] Assert in scheduling.c

lee hurley leeh at whitemoondreams.com
Wed Jan 14 21:44:06 CET 2009

I'm working on embedding stackless into a win32 app, and i'm getting an 
assert in scheduling.c when i build in debug.
Line 1006 in scheduling.c :     assert(ts->recursion_depth == 0 || 
ts->st.main == NULL && ts->st.current == NULL && prev == next);

When a task destructs it always seems that ts->st.current is never NULL, 
and thus the assert fires off.

I've used multiple scripts to reproduce this, and here's one of them:

import stackless
import time

def call_wrapper(f, args, kwargs, result_ch):
    result_ch.send(f(*args, **kwargs))

def call(f, *args, **kwargs):
    result_ch= stackless.channel()
    stackless.tasklet(call_wrapper)(f, args, kwargs, result_ch)
    return result_ch.receive()
def factorial(n):
    if n <= 1:
        return 1
    return n * call(factorial, n-1)

st = time.time()

print time.time() - st

Is this a known issue?  And can i safely disable this assert on my end?



More information about the Stackless mailing list