commit | b820d7f63132c1c6c1f301ee40be2b2729a61356 | [log] [tgz] |
---|---|---|
author | Mark Dickinson <dickinsm@gmail.com> | Mon Aug 22 12:24:46 2016 +0100 |
committer | Mark Dickinson <dickinsm@gmail.com> | Mon Aug 22 12:24:46 2016 +0100 |
tree | 0f99eb6240542ff49ddb0202dcd45a756fe2334f | |
parent | 2eedc119c211a793d0c9a0beb1abd4bb12e0802e [diff] [blame] |
Issue #27792: force int return type for modulo operations involving bools.
diff --git a/Objects/longobject.c b/Objects/longobject.c index 5b9bc67..38e7072 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c
@@ -2458,8 +2458,11 @@ *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) {