summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-08-06 09:57:49 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-08-06 09:57:49 (GMT)
commit51ced7afe72d861b46f069d757f2787f13253d32 (patch)
treef2d8a627ec32e8ada8a80f1a851e25689d9ae8f0
parent13197f4e29bf13ef04891142367febf7705693dc (diff)
downloadcpython-51ced7afe72d861b46f069d757f2787f13253d32.zip
cpython-51ced7afe72d861b46f069d757f2787f13253d32.tar.gz
cpython-51ced7afe72d861b46f069d757f2787f13253d32.tar.bz2
Issue8757: Implicit set-to-frozenset conversion not thread-safe.
-rw-r--r--Misc/NEWS2
-rw-r--r--Objects/setobject.c12
2 files changed, 5 insertions, 9 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 84ce9c8..f8e4fa8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 3.1.3?
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:
diff --git a/Objects/setobject.c b/Objects/setobject.c
index f0e1fcb..e7966bb 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;
}