Message106007
"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. |
|
Date |
User |
Action |
Args |
2010-05-18 21:07:34 | stutzbach | set | recipients:
+ stutzbach |
2010-05-18 21:07:34 | stutzbach | set | messageid: <1274216854.13.0.448353373516.issue8757@psf.upfronthosting.co.za> |
2010-05-18 21:07:32 | stutzbach | link | issue8757 messages |
2010-05-18 21:07:32 | stutzbach | create | |
|