diff options
author | Guido van Rossum <guido@python.org> | 2006-10-27 23:31:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-10-27 23:31:49 (GMT) |
commit | 4f72a78684bbfcdc43ceeabb240ceee54706c4b0 (patch) | |
tree | 743c27c5125dcef580cffe77395fe97bedf40d5f /Include | |
parent | fc2a0a8e3cb1d40fd965576060c28c8bd2ea1ad5 (diff) | |
download | cpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.zip cpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.tar.gz cpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.tar.bz2 |
Jiwon Seo's PEP 3102 implementation.
See SF#1549670.
The compiler package has not yet been updated.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/Python-ast.h | 7 | ||||
-rw-r--r-- | Include/code.h | 6 | ||||
-rw-r--r-- | Include/eval.h | 2 | ||||
-rw-r--r-- | Include/funcobject.h | 5 |
4 files changed, 15 insertions, 5 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 6182617..3073347 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -328,8 +328,10 @@ struct _excepthandler { struct _arguments { asdl_seq *args; identifier vararg; + asdl_seq *kwonlyargs; identifier kwarg; asdl_seq *defaults; + asdl_seq *kw_defaults; }; struct _keyword { @@ -427,8 +429,9 @@ comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena); excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int col_offset, PyArena *arena); -arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg, - asdl_seq * defaults, PyArena *arena); +arguments_ty arguments(asdl_seq * args, identifier vararg, asdl_seq * + kwonlyargs, identifier kwarg, asdl_seq * defaults, + asdl_seq * kw_defaults, PyArena *arena); keyword_ty keyword(identifier arg, expr_ty value, PyArena *arena); alias_ty alias(identifier name, identifier asname, PyArena *arena); diff --git a/Include/code.h b/Include/code.h index 3de77b6..e2eb59d 100644 --- a/Include/code.h +++ b/Include/code.h @@ -10,6 +10,7 @@ extern "C" { typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ + int co_kwonlyargcount; /* #keyword only arguments */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ @@ -63,8 +64,9 @@ PyAPI_DATA(PyTypeObject) PyCode_Type; /* Public interface */ PyAPI_FUNC(PyCodeObject *) PyCode_New( - int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, - PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); + int, int, int, int, int, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, int, PyObject *); /* same as struct above */ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); diff --git a/Include/eval.h b/Include/eval.h index b78dfe0..1d03c97 100644 --- a/Include/eval.h +++ b/Include/eval.h @@ -15,7 +15,7 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, PyObject **args, int argc, PyObject **kwds, int kwdc, PyObject **defs, int defc, - PyObject *closure); + PyObject *kwdefs, PyObject *closure); PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); diff --git a/Include/funcobject.h b/Include/funcobject.h index 59c19bb..7acbe6e 100644 --- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -23,6 +23,7 @@ typedef struct { PyObject *func_code; /* A code object */ PyObject *func_globals; /* A dictionary (other mappings won't do) */ PyObject *func_defaults; /* NULL or a tuple */ + PyObject *func_kwdefaults; /* NULL or a dict */ PyObject *func_closure; /* NULL or a tuple of cell objects */ PyObject *func_doc; /* The __doc__ attribute, can be anything */ PyObject *func_name; /* The __name__ attribute, a string object */ @@ -47,6 +48,8 @@ PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); +PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); @@ -60,6 +63,8 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); (((PyFunctionObject *)func) -> func_module) #define PyFunction_GET_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_defaults) +#define PyFunction_GET_KW_DEFAULTS(func) \ + (((PyFunctionObject *)func) -> func_kwdefaults) #define PyFunction_GET_CLOSURE(func) \ (((PyFunctionObject *)func) -> func_closure) |