"Barry A. Warsaw" wrote:
"CT" == Christian Tismer
writes: CT> You want most probably do this: __findattr__ should not be CT> invoked again for this instance, with this attribute name, for CT> this "thread", until you are done.
First, I think the rule should be "__findattr__ should not be invoked again for this instance, in this thread, until you are done".
Maybe this is better. Surely easier. :) [ThreadState solution - well fine so far]
MZ> I don't think this is a good idea -- continuations and MZ> coroutines might mess it up.
You might be right, but I'm not sure.
If we make __findattr__ thread safe according to the definition above, and if uthread/coroutine/continuation safety can be accomplished by the __findattr__ programmer's discipline, then I think that is enough. IOW, if we can tell the __findattr__ author to not relinquish the uthread explicitly during the __findattr__ call, we're cool. Oh, and as long as we're not somehow substantially reducing the utility of __findattr__ by making that restriction.
What I worry about is re-entrancy that isn't under the programmer's control, like the Real Thread-safety problem.
Hmm. WHat do you think about Moshe's idea to change compiling of the method? It has the nice advantage that there are no Thread-safety problems by design. The only drawback is that the contract of not-calling-myself only holds for this function. I don't know how Threadstate scale up when there are more things like these invented. Well, for the moment, the simple solution with Stackless would just be to let the interpreter recurse in this call, the same as it happens during __init__ and anything else that isn't easily turned into tail-recursion. It just blocks :-) ciao - chris -- Christian Tismer :^) mailto:tismer@tismer.com Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com