summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2016-08-22 11:24:46 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2016-08-22 11:24:46 (GMT)
commitb820d7f63132c1c6c1f301ee40be2b2729a61356 (patch)
tree0f99eb6240542ff49ddb0202dcd45a756fe2334f /Objects
parent2eedc119c211a793d0c9a0beb1abd4bb12e0802e (diff)
downloadcpython-b820d7f63132c1c6c1f301ee40be2b2729a61356.zip
cpython-b820d7f63132c1c6c1f301ee40be2b2729a61356.tar.gz
cpython-b820d7f63132c1c6c1f301ee40be2b2729a61356.tar.bz2
Issue #27792: force int return type for modulo operations involving bools.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c7
1 files changed, 5 insertions, 2 deletions
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 @@ 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) {