summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-16 06:21:44 (GMT)
committerGitHub <noreply@github.com>2017-04-16 06:21:44 (GMT)
commit813f943c592cf225871b99cffc99304c8cbbee40 (patch)
tree7c953b19864281e454abb78a8348843faf2cfd19 /Python
parent026435ce49419a3366171416c68114dd8a1144c7 (diff)
downloadcpython-813f943c592cf225871b99cffc99304c8cbbee40.zip
cpython-813f943c592cf225871b99cffc99304c8cbbee40.tar.gz
cpython-813f943c592cf225871b99cffc99304c8cbbee40.tar.bz2
bpo-29838: Add asserts for checking results of sq_length and mq_length slots. (#700)
Negative result should be returned only when an error is set.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8ae2303..60d1b7c 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1479,8 +1479,10 @@ builtin_len(PyObject *module, PyObject *obj)
Py_ssize_t res;
res = PyObject_Size(obj);
- if (res < 0 && PyErr_Occurred())
+ if (res < 0) {
+ assert(PyErr_Occurred());
return NULL;
+ }
return PyLong_FromSsize_t(res);
}