diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-04-29 12:36:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 12:36:57 (GMT) |
commit | 8c77b8cb9188165a123f2512026e3629bf03dc9b (patch) | |
tree | 863ea19f5f2c8ec179c32b3d06dc8366859ae26e /Objects/call.c | |
parent | 99fcc616d400cd31af0733c3f8cc93bcc1d32a44 (diff) | |
download | cpython-8c77b8cb9188165a123f2512026e3629bf03dc9b.zip cpython-8c77b8cb9188165a123f2512026e3629bf03dc9b.tar.gz cpython-8c77b8cb9188165a123f2512026e3629bf03dc9b.tar.bz2 |
bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.
* Update Grammar/Grammar with new typedarglist and varargslist
* Regenerate grammar files
* Update and regenerate AST related files
* Update code object
* Update marshal.c
* Update compiler and symtable
* Regenerate importlib files
* Update callable objects
* Implement positional-only args logic in ceval.c
* Regenerate frozen data
* Update standard library to account for positional-only args
* Add test file for positional-only args
* Update other test files to account for positional-only args
* Add News entry
* Update inspect module and related tests
Diffstat (limited to 'Objects/call.c')
-rw-r--r-- | Objects/call.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/call.c b/Objects/call.c index d52e7e2..68f9e87 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -320,11 +320,11 @@ _PyFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs (co->co_flags & ~PyCF_MASK) == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { /* Fast paths */ - if (argdefs == NULL && co->co_argcount == nargs) { + if (argdefs == NULL && co->co_argcount + co->co_posonlyargcount == nargs) { return function_code_fastcall(co, args, nargs, globals); } else if (nargs == 0 && argdefs != NULL - && co->co_argcount == PyTuple_GET_SIZE(argdefs)) { + && co->co_argcount + co->co_posonlyargcount == PyTuple_GET_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = _PyTuple_ITEMS(argdefs); @@ -406,11 +406,11 @@ _PyFunction_FastCallKeywords(PyObject *func, PyObject *const *stack, if (co->co_kwonlyargcount == 0 && nkwargs == 0 && (co->co_flags & ~PyCF_MASK) == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { + if (argdefs == NULL && co->co_argcount + co->co_posonlyargcount== nargs) { return function_code_fastcall(co, stack, nargs, globals); } else if (nargs == 0 && argdefs != NULL - && co->co_argcount == PyTuple_GET_SIZE(argdefs)) { + && co->co_argcount + co->co_posonlyargcount == PyTuple_GET_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ stack = _PyTuple_ITEMS(argdefs); |