summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_testinternalcapi.c.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/Modules/clinic/_testinternalcapi.c.h b/Modules/clinic/_testinternalcapi.c.h
index 8957322..41dd504 100644
--- a/Modules/clinic/_testinternalcapi.c.h
+++ b/Modules/clinic/_testinternalcapi.c.h
@@ -9,7 +9,7 @@ preserve
PyDoc_STRVAR(_testinternalcapi_compiler_codegen__doc__,
-"compiler_codegen($module, /, ast, filename, optimize)\n"
+"compiler_codegen($module, /, ast, filename, optimize, compile_mode=0)\n"
"--\n"
"\n"
"Apply compiler code generation to an AST.");
@@ -19,7 +19,8 @@ PyDoc_STRVAR(_testinternalcapi_compiler_codegen__doc__,
static PyObject *
_testinternalcapi_compiler_codegen_impl(PyObject *module, PyObject *ast,
- PyObject *filename, int optimize);
+ PyObject *filename, int optimize,
+ int compile_mode);
static PyObject *
_testinternalcapi_compiler_codegen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@@ -27,14 +28,14 @@ _testinternalcapi_compiler_codegen(PyObject *module, PyObject *const *args, Py_s
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
+ #define NUM_KEYWORDS 4
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
PyObject *ob_item[NUM_KEYWORDS];
} _kwtuple = {
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(ast), &_Py_ID(filename), &_Py_ID(optimize), },
+ .ob_item = { &_Py_ID(ast), &_Py_ID(filename), &_Py_ID(optimize), &_Py_ID(compile_mode), },
};
#undef NUM_KEYWORDS
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
@@ -43,19 +44,21 @@ _testinternalcapi_compiler_codegen(PyObject *module, PyObject *const *args, Py_s
# define KWTUPLE NULL
#endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"ast", "filename", "optimize", NULL};
+ static const char * const _keywords[] = {"ast", "filename", "optimize", "compile_mode", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "compiler_codegen",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
- PyObject *argsbuf[3];
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
PyObject *ast;
PyObject *filename;
int optimize;
+ int compile_mode = 0;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 4, 0, argsbuf);
if (!args) {
goto exit;
}
@@ -65,7 +68,15 @@ _testinternalcapi_compiler_codegen(PyObject *module, PyObject *const *args, Py_s
if (optimize == -1 && PyErr_Occurred()) {
goto exit;
}
- return_value = _testinternalcapi_compiler_codegen_impl(module, ast, filename, optimize);
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ compile_mode = _PyLong_AsInt(args[3]);
+ if (compile_mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
+ return_value = _testinternalcapi_compiler_codegen_impl(module, ast, filename, optimize, compile_mode);
exit:
return return_value;
@@ -190,4 +201,4 @@ _testinternalcapi_assemble_code_object(PyObject *module, PyObject *const *args,
exit:
return return_value;
}
-/*[clinic end generated code: output=d5e08c9d67f9721f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ab661d56a14b1a1c input=a9049054013a1b77]*/