Kaydet (Commit) 3ad323ec authored tarafından Raymond Hettinger's avatar Raymond Hettinger

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

üst 5e684339
......@@ -12,6 +12,8 @@ What's New in Python 2.7.1?
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:
......
......@@ -1855,12 +1855,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;
......@@ -1890,12 +1888,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;
......@@ -1924,12 +1920,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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment