You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stringmsg = ndefaults > 0 ? "%s() takes from %d to " : "%s() takes ";
339
-
if (kwonly_given == 0) {
340
-
throwraise(PythonBuiltinClassType.TypeError, msg + "%d positional argument%s but %d %s given%s",
341
-
getName(callable),
342
-
co_argcount - ndefaults,
343
-
co_argcount,
344
-
avail,
345
-
avail == 1 ? "was" : "were",
346
-
forgotSelf ? ". Did you forget 'self' in the function definition?" : "");
338
+
StringforgotSelfMsg = forgotSelf ? ". Did you forget 'self' in the function definition?" : "";
339
+
if (ndefaults > 0) {
340
+
if (kwonly_given == 0) {
341
+
throwraise(PythonBuiltinClassType.TypeError, "%s() takes from %d to %d positional argument%s but %d %s given%s",
342
+
getName(callable),
343
+
co_argcount - ndefaults,
344
+
co_argcount,
345
+
co_argcount == 1 ? "" : "s",
346
+
avail,
347
+
avail == 1 ? "was" : "were",
348
+
forgotSelfMsg);
349
+
} else {
350
+
throwraise(PythonBuiltinClassType.TypeError, "%s() takes from %d to %d positional argument%s but %d positional argument%s (and %d keyword-only argument%s) were given%s",
351
+
getName(callable),
352
+
co_argcount - ndefaults,
353
+
co_argcount,
354
+
co_argcount == 1 ? "" : "s",
355
+
avail,
356
+
avail == 1 ? "" : "s",
357
+
kwonly_given,
358
+
kwonly_given == 1 ? "" : "s",
359
+
forgotSelfMsg);
360
+
}
347
361
} else {
348
-
throwraise(PythonBuiltinClassType.TypeError, msg + "%d positional argument%s but %d positional argument%s (and %d keyword-only argument%s) were given%s",
349
-
getName(callable),
350
-
co_argcount,
351
-
co_argcount == 1 ? "" : "s",
352
-
avail,
353
-
avail == 1 ? "" : "s",
354
-
kwonly_given,
355
-
kwonly_given == 1 ? "" : "s",
356
-
forgotSelf ? ". Did you forget 'self' in the function definition?" : "");
362
+
if (kwonly_given == 0) {
363
+
throwraise(PythonBuiltinClassType.TypeError, "%s() takes %d positional argument%s but %d %s given%s",
364
+
getName(callable),
365
+
co_argcount - ndefaults,
366
+
co_argcount == 1 ? "" : "s",
367
+
avail,
368
+
avail == 1 ? "was" : "were",
369
+
forgotSelfMsg);
370
+
} else {
371
+
throwraise(PythonBuiltinClassType.TypeError, "%s() takes %d positional argument%s but %d positional argument%s (and %d keyword-only argument%s) were given%s",
0 commit comments