Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 459f1e3

Browse files
author
Anselm Kruis
committed
Stackless issue #137: Add Stackless support to "call" functions
Fix Stackless support of _PyCFunction_FastCallKeywords().
1 parent e77a76a commit 459f1e3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Objects/methodobject.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
312312
func = (PyCFunctionObject*)func_obj;
313313
meth = PyCFunction_GET_FUNCTION(func);
314314
self = PyCFunction_GET_SELF(func);
315-
flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
315+
flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
316316

317317
switch (flags)
318318
{
@@ -328,6 +328,7 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
328328
goto no_keyword_error;
329329
}
330330

331+
STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS);
331332
result = (*meth) (self, NULL);
332333
break;
333334

@@ -343,11 +344,13 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
343344
goto no_keyword_error;
344345
}
345346

347+
STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS);
346348
result = (*meth) (self, args[0]);
347349
break;
348350

349351
case METH_FASTCALL:
350352
/* Fast-path: avoid temporary dict to pass keyword arguments */
353+
STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS);
351354
result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames);
352355
break;
353356

@@ -381,10 +384,12 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
381384
kwdict = NULL;
382385
}
383386

387+
STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS);
384388
result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict);
385389
Py_XDECREF(kwdict);
386390
}
387391
else {
392+
STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS);
388393
result = (*meth) (self, argtuple);
389394
}
390395
Py_DECREF(argtuple);
@@ -397,6 +402,7 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
397402
"METH_OLDARGS is no longer supported!");
398403
return NULL;
399404
}
405+
STACKLESS_ASSERT();
400406

401407
result = _Py_CheckFunctionResult(func_obj, result, NULL);
402408
return result;

0 commit comments

Comments
 (0)