Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a46fb38 commit 1991ddcCopy full SHA for 1991ddc
1 file changed
Objects/abstract.c
@@ -384,10 +384,21 @@ PyNumber_Multiply(v, w)
384
}
385
m = tp->tp_as_sequence;
386
if (m && m->sq_repeat) {
387
- if (!PyInt_Check(w))
+ long mul_value;
388
+
389
+ if (PyInt_Check(w)) {
390
+ mul_value = PyInt_AsLong(w);
391
+ }
392
+ else if (PyLong_Check(w)) {
393
+ mul_value = PyLong_AsLong(w);
394
+ if (PyErr_Occurred())
395
+ return NULL;
396
397
+ else {
398
return type_error(
399
"can't multiply sequence with non-int");
- return (*m->sq_repeat)(v, (int)PyInt_AsLong(w));
400
401
+ return (*m->sq_repeat)(v, (int)mul_value);
402
403
return type_error("bad operand type(s) for *");
404
0 commit comments