summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-11-14 13:56:40 (GMT)
committerGitHub <noreply@github.com>2022-11-14 13:56:40 (GMT)
commita3ac9232f859a144b5e1db494dbb928e0cd169ab (patch)
tree961e093bd549b81bf1311e3129b9305587bd26e9 /Include/internal
parent06d4e02c3b3526b5d90e41a0a0befa8663e08f27 (diff)
downloadcpython-a3ac9232f859a144b5e1db494dbb928e0cd169ab.zip
cpython-a3ac9232f859a144b5e1db494dbb928e0cd169ab.tar.gz
cpython-a3ac9232f859a144b5e1db494dbb928e0cd169ab.tar.bz2
gh-87092: expose the compiler's codegen to python for unit tests (GH-99111)
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_compile.h7
-rw-r--r--Include/internal/pycore_global_objects_fini_generated.h1
-rw-r--r--Include/internal/pycore_global_strings.h1
-rw-r--r--Include/internal/pycore_runtime_init_generated.h1
-rw-r--r--Include/internal/pycore_unicodeobject_generated.h2
5 files changed, 12 insertions, 0 deletions
diff --git a/Include/internal/pycore_compile.h b/Include/internal/pycore_compile.h
index cb490ab..967fe92 100644
--- a/Include/internal/pycore_compile.h
+++ b/Include/internal/pycore_compile.h
@@ -40,6 +40,13 @@ extern int _PyAST_Optimize(
_PyASTOptimizeState *state);
/* Access compiler internals for unit testing */
+
+PyAPI_FUNC(PyObject*) _PyCompile_CodeGen(
+ PyObject *ast,
+ PyObject *filename,
+ PyCompilerFlags *flags,
+ int optimize);
+
PyAPI_FUNC(PyObject*) _PyCompile_OptimizeCfg(
PyObject *instructions,
PyObject *consts);
diff --git a/Include/internal/pycore_global_objects_fini_generated.h b/Include/internal/pycore_global_objects_fini_generated.h
index 8883bbb..0b5833c 100644
--- a/Include/internal/pycore_global_objects_fini_generated.h
+++ b/Include/internal/pycore_global_objects_fini_generated.h
@@ -781,6 +781,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(arguments));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(argv));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(as_integer_ratio));
+ _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(ast));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(attribute));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(authorizer_callback));
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(autocommit));
diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h
index 1227142..5bfd4be 100644
--- a/Include/internal/pycore_global_strings.h
+++ b/Include/internal/pycore_global_strings.h
@@ -267,6 +267,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(arguments)
STRUCT_FOR_ID(argv)
STRUCT_FOR_ID(as_integer_ratio)
+ STRUCT_FOR_ID(ast)
STRUCT_FOR_ID(attribute)
STRUCT_FOR_ID(authorizer_callback)
STRUCT_FOR_ID(autocommit)
diff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h
index e7fba8d..7228cb5 100644
--- a/Include/internal/pycore_runtime_init_generated.h
+++ b/Include/internal/pycore_runtime_init_generated.h
@@ -773,6 +773,7 @@ extern "C" {
INIT_ID(arguments), \
INIT_ID(argv), \
INIT_ID(as_integer_ratio), \
+ INIT_ID(ast), \
INIT_ID(attribute), \
INIT_ID(authorizer_callback), \
INIT_ID(autocommit), \
diff --git a/Include/internal/pycore_unicodeobject_generated.h b/Include/internal/pycore_unicodeobject_generated.h
index ada0485..208a1e1 100644
--- a/Include/internal/pycore_unicodeobject_generated.h
+++ b/Include/internal/pycore_unicodeobject_generated.h
@@ -440,6 +440,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(as_integer_ratio);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(ast);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(attribute);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(authorizer_callback);