summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-08-06 09:52:17 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-08-06 09:52:17 (GMT)
commit38bf2ccf4c461a1c65aafffccb87ddb38cf52b5c (patch)
treee359de50a65fdc1d75ff18c6ca35baf6cef4e3e4 /Objects/setobject.c
parent4f3086f264742c5c09cc658fb2031773554eccea (diff)
downloadcpython-38bf2ccf4c461a1c65aafffccb87ddb38cf52b5c.zip
cpython-38bf2ccf4c461a1c65aafffccb87ddb38cf52b5c.tar.gz
cpython-38bf2ccf4c461a1c65aafffccb87ddb38cf52b5c.tar.bz2
Issue8757: Implicit set-to-frozenset conversion not thread-safe.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index b35fef5..3b448da 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1846,12 +1846,10 @@ set_contains(PySetObject *so, PyObject *key)
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 @@ set_remove(PySetObject *so, PyObject *key)
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 @@ set_discard(PySetObject *so, PyObject *key)
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;
}