Re: [Python-Dev] Replacing threads with swapcontext()

2010-04-01 Thread Alexander Sabourenkov
Nick Coghlan wrote: Off the top of my head, recursion limit checks will definitely go haywire, and I would expect threading.local() and exception handling to explode at some point (although the latter depends on what you mean by "switching C stacks" - if you really are just fiddling the stack poi

[Python-Dev] Replacing threads with swapcontext()

2010-03-31 Thread Alexander Sabourenkov
Hello. I have went and replaced Python threads with explicitly-scheduled coroutines using swapcontext() family of functions (basically out of frustration with the greenlet). I have two questions. 1. Is it as dangerous to switch C stacks and not switch PyThreadState as I suspect? In particul