[Python-checkins] Neaten the code without any algorithmic change. (GH-10466)

Raymond Hettinger webhook-mailer at python.org
Sun Nov 11 17:35:51 EST 2018


https://github.com/python/cpython/commit/f9ec1b9f5257b7a1cb6770e8398da626c86a5b7b
commit: f9ec1b9f5257b7a1cb6770e8398da626c86a5b7b
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-11-11T14:35:47-08:00
summary:

Neaten the code without any algorithmic change. (GH-10466)

Remove unneeded assertion (we already know so is a PySetObject *).

files:
M Objects/setobject.c

diff --git a/Objects/setobject.c b/Objects/setobject.c
index ce5092195975..035b1db06d8c 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -701,17 +701,14 @@ static PyObject *
 set_pop(PySetObject *so, PyObject *Py_UNUSED(ignored))
 {
     /* Make sure the search finger is in bounds */
-    setentry *entry, *limit;
+    setentry *entry = so->table + (so->finger & so->mask);
+    setentry *limit = so->table + so->mask;
     PyObject *key;
 
-    assert (PyAnySet_Check(so));
     if (so->used == 0) {
         PyErr_SetString(PyExc_KeyError, "pop from an empty set");
         return NULL;
     }
-
-    entry = so->table + (so->finger & so->mask);
-    limit = so->table + so->mask;
     while (entry->key == NULL || entry->key==dummy) {
         entry++;
         if (entry > limit)



More information about the Python-checkins mailing list