[PEAK] trellis activity does not save/restore Contextual context between task switches

Andrew Svetlov andrew.svetlov at gmail.com
Thu Apr 2 21:03:59 EDT 2009

Looks like my message was not delivered.
I replay it.

Sorry for delay.
I found an issue: it's trivial to add patch to activity.py but not
easy to add unittest.
Main problem is: existing codebase requires python 2.3 compatibility,
but context.with_ works quite different than with statement in case of
yielding result from generator. with_ retores context in finally block
when generator yield statement reached and execution point goes out of
with_ controlled function but _with_ statement doesn't do it until end
of block reached.

I cannot convert my unittests line-by-line.
>From my perspective there are 2 solutions:
 1. run uniittests for parallel task execution with context switching
only if python version >= 2.5
 2. make simple and not obvious test for saving/restoring
context.State in task with direct modification of context state inside
task generator and do nothing else.

What version are you prefer?
Guys, I really need suggestion.
Patch is done, I included it in my monkeypatch list and for me all works.
But I like to see this behavior in standard trellis.

Problem is in unittests only.

More information about the PEAK mailing list