Skip to content

Commit 086c3ae

Browse files
authored
bpo-31835: Optimize also FASTCALL using __future__ (#4087)
_PyFunction_FastCallDict() and _PyFunction_FastCallKeywords() now also takes the fast path if the code object uses __future__ (CO_FUTURE_xxx flags).
1 parent 95f1a7b commit 086c3ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/call.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ _PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
315315

316316
if (co->co_kwonlyargcount == 0 &&
317317
(kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) &&
318-
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
318+
(co->co_flags & ~PyCF_MASK) == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
319319
{
320320
/* Fast paths */
321321
if (argdefs == NULL && co->co_argcount == nargs) {
@@ -402,7 +402,7 @@ _PyFunction_FastCallKeywords(PyObject *func, PyObject **stack,
402402
be unique */
403403

404404
if (co->co_kwonlyargcount == 0 && nkwargs == 0 &&
405-
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
405+
(co->co_flags & ~PyCF_MASK) == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
406406
{
407407
if (argdefs == NULL && co->co_argcount == nargs) {
408408
return function_code_fastcall(co, stack, nargs, globals);

0 commit comments

Comments
 (0)