diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-06 18:31:24 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-06 18:31:24 (GMT) |
commit | 5ba0cbe39221ff8985ce5a4702a3b01a17ae3248 (patch) | |
tree | 1902f3101c306803111ccca197534fcab4bd7a71 /Objects/setobject.c | |
parent | fe889f3c628797e5d4eb5e8cf26a783ed504a251 (diff) | |
download | cpython-5ba0cbe39221ff8985ce5a4702a3b01a17ae3248.zip cpython-5ba0cbe39221ff8985ce5a4702a3b01a17ae3248.tar.gz cpython-5ba0cbe39221ff8985ce5a4702a3b01a17ae3248.tar.bz2 |
* set_new() doesn't need to zero the structure a second time after tp_alloc
has already done the job.
* Use a macro form of PyErr_Occurred() inside the set_lookkey() function.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 9952ec0..c46df83 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -66,7 +66,7 @@ set_lookkey(PySetObject *so, PyObject *key, register long hash) if (entry->hash == hash) { /* error can't have been checked yet */ checked_error = 1; - if (PyErr_Occurred()) { + if (_PyErr_OCCURRED()) { restore_error = 1; PyErr_Fetch(&err_type, &err_value, &err_tb); } @@ -104,7 +104,7 @@ set_lookkey(PySetObject *so, PyObject *key, register long hash) if (entry->hash == hash && entry->key != dummy) { if (!checked_error) { checked_error = 1; - if (PyErr_Occurred()) { + if (_PyErr_OCCURRED()) { restore_error = 1; PyErr_Fetch(&err_type, &err_value, &err_tb); @@ -720,7 +720,10 @@ make_new_set(PyTypeObject *type, PyObject *iterable) if (so == NULL) return NULL; - EMPTY_TO_MINSIZE(so); + /* tp_alloc has already zeroed the structure */ + assert(so->table == NULL && so->fill == 0 && so->used == 0); + so->table = so->smalltable; + so->mask = PySet_MINSIZE - 1; so->lookup = set_lookkey_string; so->hash = -1; so->weakreflist = NULL; |