[Python-checkins] bpo-32999: ast: Convert useless check to assert (GH-6197)

Miss Islington (bot) webhook-mailer at python.org
Fri Mar 23 05:43:17 EDT 2018


https://github.com/python/cpython/commit/c71edab15d023360388da8360700d419b5f48c81
commit: c71edab15d023360388da8360700d419b5f48c81
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-03-23T02:43:11-07:00
summary:

bpo-32999: ast: Convert useless check to assert (GH-6197)

(cherry picked from commit c65bf3fe4a2bde424b79e350f36b7aaa3f6476f6)

Co-authored-by: INADA Naoki <methane at users.noreply.github.com>

files:
M Modules/_abc.c

diff --git a/Modules/_abc.c b/Modules/_abc.c
index aa091c717dec..562a2e6d730d 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -647,9 +647,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
     assert(PyTuple_Check(mro));
     for (pos = 0; pos < PyTuple_GET_SIZE(mro); pos++) {
         PyObject *mro_item = PyTuple_GET_ITEM(mro, pos);
-        if (mro_item == NULL) {
-            goto end;
-        }
+        assert(mro_item != NULL);
         if ((PyObject *)self == mro_item) {
             if (_add_to_weak_set(&impl->_abc_cache, subclass) < 0) {
                 goto end;



More information about the Python-checkins mailing list