Commit a22f02a0 authored by Raymond Hettinger's avatar Raymond Hettinger

Use Py_CLEAR(). Add unrelated test.

parent 440ed1ad
...@@ -23,6 +23,9 @@ class TestJointOps(unittest.TestCase): ...@@ -23,6 +23,9 @@ class TestJointOps(unittest.TestCase):
self.s = self.thetype(word) self.s = self.thetype(word)
self.d = dict.fromkeys(word) self.d = dict.fromkeys(word)
def test_new_or_init(self):
self.assertRaises(TypeError, self.thetype, [], 2)
def test_uniquification(self): def test_uniquification(self):
actual = sorted(self.s) actual = sorted(self.s)
expected = sorted(self.d) expected = sorted(self.d)
......
...@@ -105,7 +105,7 @@ frozenset_dict_wrapper(PyObject *d) ...@@ -105,7 +105,7 @@ frozenset_dict_wrapper(PyObject *d)
w = (PySetObject *)make_new_set(&PyFrozenSet_Type, NULL); w = (PySetObject *)make_new_set(&PyFrozenSet_Type, NULL);
if (w == NULL) if (w == NULL)
return NULL; return NULL;
Py_DECREF(w->data); Py_CLEAR(w->data);
Py_INCREF(d); Py_INCREF(d);
w->data = d; w->data = d;
return (PyObject *)w; return (PyObject *)w;
......
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