[Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it

"Martin v. Löwis" martin at v.loewis.de
Mon Nov 9 23:19:13 CET 2009


> I'm not sure, but isn't that thread-unsafe?

You are right; it's thread-unsafe.

I would fix it by catching the RuntimeError, and retrying. Given the
current GIL strategy (including proposed changes to it), it won't happen
two times in a row, so the number of retries would be bounded.

Regards,
Martin


More information about the Python-Dev mailing list