This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stutzbach
Recipients stutzbach
Date 2010-05-18.21:07:31
SpamBayes Score 0.00070572016
Marked as misclassified No
Message-id <1274216854.13.0.448353373516.issue8757@psf.upfronthosting.co.za>
In-reply-to
Content
"some_set in some_set_of_sets" contains a race condition that can lead to odd behavior.  To perform the test, the set_contains() function in setobject.c creates a temporary frozenset object (t), swaps the bodies of some_set and t, checks if t is in some_set_of_sets, then swaps the bodies back.

Unfortunately, comparisons or hash functions may release the GIL, so the swapped bodies may be exposed on a different thread, i.e., "some_set in some_set_of_sets" may cause "some_set" to be empty on some other thread.

The same race condition exists in set_discard() and set_remove().

Attached is a short script that demonstrates the problem and could be easily converted to a unit test.
History
Date User Action Args
2010-05-18 21:07:34stutzbachsetrecipients: + stutzbach
2010-05-18 21:07:34stutzbachsetmessageid: <1274216854.13.0.448353373516.issue8757@psf.upfronthosting.co.za>
2010-05-18 21:07:32stutzbachlinkissue8757 messages
2010-05-18 21:07:32stutzbachcreate