Skip to content

Commit a2a07ea

Browse files
committed
Check for 'total_args' instead of 'self'
1 parent f73dd59 commit a2a07ea

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

Python/bytecodes.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,13 +4298,14 @@ dummy_func(
42984298
arguments--;
42994299
total_args++;
43004300
}
4301+
EXIT_IF(total_args == 0);
43014302
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
43024303
EXIT_IF(!Py_IS_TYPE(method, &PyMethodDescr_Type));
43034304
PyMethodDef *meth = method->d_method;
43044305
EXIT_IF(meth->ml_flags != (METH_FASTCALL|METH_KEYWORDS));
43054306
PyTypeObject *d_type = method->d_common.d_type;
43064307
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
4307-
EXIT_IF(self == NULL);
4308+
assert(self != NULL);
43084309
EXIT_IF(!Py_IS_TYPE(self, d_type));
43094310
STAT_INC(CALL, hit);
43104311
int nargs = total_args - 1;
@@ -4377,13 +4378,14 @@ dummy_func(
43774378
arguments--;
43784379
total_args++;
43794380
}
4381+
EXIT_IF(total_args == 0);
43804382
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
43814383
/* Builtin METH_FASTCALL methods, without keywords */
43824384
EXIT_IF(!Py_IS_TYPE(method, &PyMethodDescr_Type));
43834385
PyMethodDef *meth = method->d_method;
43844386
EXIT_IF(meth->ml_flags != METH_FASTCALL);
43854387
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
4386-
EXIT_IF(self == NULL);
4388+
assert(self != NULL);
43874389
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
43884390
STAT_INC(CALL, hit);
43894391
int nargs = total_args - 1;

Python/executor_cases.c.h

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)