diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-29 12:18:50 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-29 12:18:50 (GMT) |
commit | fd66e51c4c1ff9293b0f332d6ebc8093b2ef12bb (patch) | |
tree | 33e303619714002b5554c6e93e839fa51250458a /Objects | |
parent | 1fd77708e3813a28f023671c112231a81bb631f0 (diff) | |
download | cpython-fd66e51c4c1ff9293b0f332d6ebc8093b2ef12bb.zip cpython-fd66e51c4c1ff9293b0f332d6ebc8093b2ef12bb.tar.gz cpython-fd66e51c4c1ff9293b0f332d6ebc8093b2ef12bb.tar.bz2 |
Merged revisions 60383-60407 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60388 | thomas.heller | 2008-01-28 09:44:13 +0100 (Mon, 28 Jan 2008) | 1 line
Revert rev. 59925, it breaks comtypes (I need to further examine this).
........
r60397 | raymond.hettinger | 2008-01-28 21:34:33 +0100 (Mon, 28 Jan 2008) | 5 lines
Make PySet_Add() work with frozensets.
Works like PyTuple_SetItem() to build-up values in a brand new frozenset.
Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset.
........
r60398 | raymond.hettinger | 2008-01-28 22:34:30 +0100 (Mon, 28 Jan 2008) | 1 line
Let marshal built-up sets and frozensets one element at a time (without creating an intermediate tuple).
........
r60399 | raymond.hettinger | 2008-01-28 22:47:42 +0100 (Mon, 28 Jan 2008) | 1 line
Factor-out common code with a new macro
........
r60400 | raymond.hettinger | 2008-01-28 22:48:07 +0100 (Mon, 28 Jan 2008) | 1 line
Factor-out common code with a new macro
........
r60401 | raymond.hettinger | 2008-01-28 22:51:25 +0100 (Mon, 28 Jan 2008) | 1 line
Removed unnecessary conditional (spotted by Neal Norwitz).
........
r60403 | gregory.p.smith | 2008-01-29 00:21:00 +0100 (Tue, 29 Jan 2008) | 4 lines
Disable use of BerkeleyDB 4.6.x to see what the odd platform buildbots
think. In particular, neal norwitz has traced an Ubuntu sparc64 crash
to the Lib/test/bsddb/test_basics.py test when opening a db with DB_THREAD.
........
r60405 | brett.cannon | 2008-01-29 05:13:07 +0100 (Tue, 29 Jan 2008) | 2 lines
Fix the reindent rule to use $(BUILDPYTHON).
........
r60406 | brett.cannon | 2008-01-29 05:18:04 +0100 (Tue, 29 Jan 2008) | 3 lines
Update Vim syntax highlighting to specify what revision was used to generate
the file.
........
r60407 | brett.cannon | 2008-01-29 05:20:56 +0100 (Tue, 29 Jan 2008) | 2 lines
Ignore .pyc and .pyo files.
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/setobject.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index b37db44..d97dc28 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2127,17 +2127,7 @@ PySet_New(PyObject *iterable) PyObject * PyFrozenSet_New(PyObject *iterable) { - PyObject *args, *result; - - if (iterable == NULL) - args = PyTuple_New(0); - else - args = PyTuple_Pack(1, iterable); - if (args == NULL) - return NULL; - result = frozenset_new(&PyFrozenSet_Type, args, NULL); - Py_DECREF(args); - return result; + return make_new_set(&PyFrozenSet_Type, iterable); } Py_ssize_t @@ -2153,7 +2143,7 @@ PySet_Size(PyObject *anyset) int PySet_Clear(PyObject *set) { - if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) { + if (!PySet_Check(set)) { PyErr_BadInternalCall(); return -1; } @@ -2173,7 +2163,7 @@ PySet_Contains(PyObject *anyset, PyObject *key) int PySet_Discard(PyObject *set, PyObject *key) { - if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) { + if (!PySet_Check(set)) { PyErr_BadInternalCall(); return -1; } @@ -2181,13 +2171,13 @@ PySet_Discard(PyObject *set, PyObject *key) } int -PySet_Add(PyObject *set, PyObject *key) +PySet_Add(PyObject *anyset, PyObject *key) { - if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) { + if (!PyAnySet_Check(anyset)) { PyErr_BadInternalCall(); return -1; } - return set_add_key((PySetObject *)set, key); + return set_add_key((PySetObject *)anyset, key); } int @@ -2224,7 +2214,7 @@ _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash) PyObject * PySet_Pop(PyObject *set) { - if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) { + if (!PySet_Check(set)) { PyErr_BadInternalCall(); return NULL; } @@ -2234,7 +2224,7 @@ PySet_Pop(PyObject *set) int _PySet_Update(PyObject *set, PyObject *iterable) { - if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) { + if (!PySet_Check(set)) { PyErr_BadInternalCall(); return -1; } @@ -2330,7 +2320,6 @@ test_c_api(PySetObject *so) f = PyFrozenSet_New(dup); assert(PySet_Size(f) == 3); assert(PyFrozenSet_CheckExact(f)); - assertRaises(PySet_Add(f, elem) == -1, PyExc_SystemError); assertRaises(PySet_Discard(f, elem) == -1, PyExc_SystemError); assertRaises(PySet_Pop(f) == NULL, PyExc_SystemError); Py_DECREF(f); |