]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport gvanrossum's patch:
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 04:40:05 +0000 (04:40 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 04:40:05 +0000 (04:40 +0000)
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.

Objects/abstract.c

index 162c53c9b3671d74be6f2b7d4e2f416ffbe88e9f..0556c5a2a54d5819f5dcfd4598ff688ce2473e45 100644 (file)
@@ -740,8 +740,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);