"Moore, Paul" <Paul.Moore at atosorigin.com> writes: > From: Aahz >> On Mon, Jul 19, 2004, Phillip J. Eby wrote: >>> >>> However, anything that calls back into Python code isn't necessarily >>> atomic, and in general, almost anything can call back into Python code. >> >> Yup. > >>> For example, the seemingly harmless dictionary item assignment can call >>> back into Python for a custom type's __hash__ and __eq__ methods, so could >>> it be that a thread switch could actually occur during this statement: >>> >>> foo[bar] = baz >>> >>> if 'bar' has such custom methods? Maybe I'm wrong, and the GIL is still >>> held in such a case, but I'm not sure *how*. > >> No, it isn't. > > Hmm. I think that makes the point fairly well - thread safety is subtle, and > not to be taken lightly. Whether that was Raymond's point or mine, I'm less > sure :-) To be fair, you don't need threads to tickle very odd behaviour here -- check out vicious_descriptor_nonsense in test_descr or test_mutants or some stuff in test_sort. Threads just add that delicious air of unpredictability to the mix :-) Cheers, mwh -- To summarise the summary of the summary:- people are a problem. -- The Hitch-Hikers Guide to the Galaxy, Episode 12
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4