summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-04-16 16:44:51 (GMT)
committerGuido van Rossum <guido@python.org>2002-04-16 16:44:51 (GMT)
commite8fc640349dee549e4804df643cf6653a954e125 (patch)
tree3a03234b84fbca445f0c9241b2c9d2cdd8a90619 /Objects
parent7766091e0447d6eb641526c8e70b13ab62f7b561 (diff)
downloadcpython-e8fc640349dee549e4804df643cf6653a954e125.zip
cpython-e8fc640349dee549e4804df643cf6653a954e125.tar.gz
cpython-e8fc640349dee549e4804df643cf6653a954e125.tar.bz2
SF bug 544647.
PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it existed, even if nb_inplace_multiply also existed and the arguments weren't right for sq_inplace_repeat. Change this to only use sq_inplace_repeat if nb_inplace_multiply isn't defined. Bugfix candidate.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index cb2807d..622e819 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -742,8 +742,12 @@ PyObject *
PyNumber_InPlaceMultiply(PyObject *v, PyObject *w)
{
PyObject * (*g)(PyObject *, int) = NULL;
- if (HASINPLACE(v) && v->ob_type->tp_as_sequence &&
- (g = v->ob_type->tp_as_sequence->sq_inplace_repeat)) {
+ if (HASINPLACE(v) &&
+ v->ob_type->tp_as_sequence &&
+ (g = v->ob_type->tp_as_sequence->sq_inplace_repeat) &&
+ !(v->ob_type->tp_as_number &&
+ v->ob_type->tp_as_number->nb_inplace_multiply))
+ {
long n;
if (PyInt_Check(w)) {
n = PyInt_AsLong(w);