diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2016-08-22 12:24:46 +0100 |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2016-08-22 12:24:46 +0100 |
commit | b820d7f63132c1c6c1f301ee40be2b2729a61356 (patch) | |
tree | 0f99eb6240542ff49ddb0202dcd45a756fe2334f /Objects/longobject.c | |
parent | 2eedc119c211a793d0c9a0beb1abd4bb12e0802e (diff) | |
download | cpython-git-b820d7f63132c1c6c1f301ee40be2b2729a61356.tar.gz |
Issue #27792: force int return type for modulo operations involving bools.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 5b9bc67a48..38e707220a 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2458,8 +2458,11 @@ long_divrem(PyLongObject *a, PyLongObject *b, *pdiv = (PyLongObject*)PyLong_FromLong(0); if (*pdiv == NULL) return -1; - Py_INCREF(a); - *prem = (PyLongObject *) a; + *prem = (PyLongObject *)long_long((PyObject *)a); + if (*prem == NULL) { + Py_CLEAR(*pdiv); + return -1; + } return 0; } if (size_b == 1) { |