> A context switch can happen between any two of those instructions.
> That means one thread could load the global, then another thread could
> load the same value, resulting in both of them writing back the same
> incremented value. Or, between opcodes 6 and 8 (between the lines of
> Python code), you could store the value, then fetch back a different
> value.

I see now. Then we can go with Steven's idea. Let's keep the changes in locals 
temporarily and when it yields or returns then modify the __statics__ member. 
And even if it's a generator it will stop iteration some time and if it doesn't 
then the member wasn't meant to be modified.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/FCDWRSCIF6KZQ73N2AKOGWIEY6W4FGK3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to