don't put runtime values in array initializer for C89 compliance (closes #20588)
diff --git a/Misc/NEWS b/Misc/NEWS
index edefb80..ac1ba0d 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
Core and Builtins
-----------------
+- Issue #20588: Make Python-ast.c C89 compliant.
+
- Issue #20437: Fixed 21 potential bugs when deleting objects references.
- Issue #20538: UTF-7 incremental decoder produced inconsistant string when
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 0b6c88c..4b84e0f 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1150,10 +1150,14 @@
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{
mod_ty res;
- PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
- (PyObject*)Interactive_type};
+ PyObject *req_type[3];
char *req_name[] = {"Module", "Expression", "Interactive"};
int isinstance;
+
+ req_type[0] = (PyObject*)Module_type;
+ req_type[1] = (PyObject*)Expression_type;
+ req_type[2] = (PyObject*)Interactive_type;
+
assert(0 <= mode && mode <= 2);
init_types();
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 7bf2c50..aa03233 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -6957,10 +6957,14 @@
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{
mod_ty res;
- PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
- (PyObject*)Interactive_type};
+ PyObject *req_type[3];
char *req_name[] = {"Module", "Expression", "Interactive"};
int isinstance;
+
+ req_type[0] = (PyObject*)Module_type;
+ req_type[1] = (PyObject*)Expression_type;
+ req_type[2] = (PyObject*)Interactive_type;
+
assert(0 <= mode && mode <= 2);
init_types();