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.
This commit is contained in:
Guido van Rossum 2002-04-16 16:44:51 +00:00
parent 7766091e04
commit e8fc640349
2 changed files with 33 additions and 2 deletions

View file

@ -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);