[Python-checkins] r83756 - in python/branches/release31-maint: Misc/NEWS Objects/setobject.c

raymond.hettinger python-checkins at python.org
Fri Aug 6 11:57:49 CEST 2010


Author: raymond.hettinger
Date: Fri Aug  6 11:57:49 2010
New Revision: 83756

Log:
Issue8757:  Implicit set-to-frozenset conversion not thread-safe.

Modified:
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Objects/setobject.c

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Fri Aug  6 11:57:49 2010
@@ -12,6 +12,8 @@
 Core and Builtins
 -----------------
 
+- Issue #83755:  Implicit set-to-frozenset conversion was not thread-safe.
+
 - Issue #9416: Fix some issues with complex formatting where the
   output with no type specifier failed to match the str output:
 

Modified: python/branches/release31-maint/Objects/setobject.c
==============================================================================
--- python/branches/release31-maint/Objects/setobject.c	(original)
+++ python/branches/release31-maint/Objects/setobject.c	Fri Aug  6 11:57:49 2010
@@ -1846,12 +1846,10 @@
         if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
             return -1;
         PyErr_Clear();
-        tmpkey = make_new_set(&PyFrozenSet_Type, NULL);
+        tmpkey = make_new_set(&PyFrozenSet_Type, key);
         if (tmpkey == NULL)
             return -1;
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         rv = set_contains(so, tmpkey);
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         Py_DECREF(tmpkey);
     }
     return rv;
@@ -1881,12 +1879,10 @@
         if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
             return NULL;
         PyErr_Clear();
-        tmpkey = make_new_set(&PyFrozenSet_Type, NULL);
+        tmpkey = make_new_set(&PyFrozenSet_Type, key);
         if (tmpkey == NULL)
             return NULL;
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         rv = set_discard_key(so, tmpkey);
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         Py_DECREF(tmpkey);
         if (rv == -1)
             return NULL;
@@ -1915,12 +1911,10 @@
         if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
             return NULL;
         PyErr_Clear();
-        tmpkey = make_new_set(&PyFrozenSet_Type, NULL);
+        tmpkey = make_new_set(&PyFrozenSet_Type, key);
         if (tmpkey == NULL)
             return NULL;
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         result = set_discard(so, tmpkey);
-        set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
         Py_DECREF(tmpkey);
         return result;
     }


More information about the Python-checkins mailing list