diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-07-01 10:35:05 (GMT) |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2019-07-01 10:35:05 (GMT) |
commit | 4a2edc34a405150d0b23ecfdcb401e7cf59f4650 (patch) | |
tree | d4d88459768f103b76ce92536ba047b305ae0d24 /Doc/c-api/code.rst | |
parent | fc1fbe6099e826e8304eadf781af7c10d739fc40 (diff) | |
download | cpython-4a2edc34a405150d0b23ecfdcb401e7cf59f4650.zip cpython-4a2edc34a405150d0b23ecfdcb401e7cf59f4650.tar.gz cpython-4a2edc34a405150d0b23ecfdcb401e7cf59f4650.tar.bz2 |
bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set PyCode_New as a compatibility wrapper (GH-13959)
Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper
Diffstat (limited to 'Doc/c-api/code.rst')
-rw-r--r-- | Doc/c-api/code.rst | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst index 7353df5..3c4f669 100644 --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -33,20 +33,21 @@ bound into a function. Return the number of free variables in *co*. -.. c:function:: PyCodeObject* PyCode_New(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) +.. c:function:: PyCodeObject* PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) - Return a new code object. If you need a dummy code object to - create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling - :c:func:`PyCode_New` directly can bind you to a precise Python - version since the definition of the bytecode changes often. - - .. versionchanged:: 3.8 - An extra parameter is required (*posonlyargcount*) to support :PEP:`570`. - The first parameter (*argcount*) now represents the total number of positional arguments, - including positional-only. + Return a new code object. If you need a dummy code object to create a frame, + use :c:func:`PyCode_NewEmpty` instead. Calling :c:func:`PyCode_New` directly + can bind you to a precise Python version since the definition of the bytecode + changes often. .. audit-event:: code.__new__ code,filename,name,argcount,posonlyargcount,kwonlyargcount,nlocals,stacksize,flags c.PyCode_New +.. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) + + Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positonal-only arguments. + + .. versionadded:: 3.8 + .. c:function:: PyCodeObject* PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) Return a new empty code object with the specified filename, |