bpo-39969: Remove ast.Param node class as is no longer used (GH-19020)
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index f58dd9c..ed5aba6 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -107,8 +107,6 @@
PyObject *Not_type;
PyObject *Or_singleton;
PyObject *Or_type;
- PyObject *Param_singleton;
- PyObject *Param_type;
PyObject *Pass_type;
PyObject *Pow_singleton;
PyObject *Pow_type;
@@ -332,8 +330,6 @@
Py_CLEAR(astmodulestate(module)->Not_type);
Py_CLEAR(astmodulestate(module)->Or_singleton);
Py_CLEAR(astmodulestate(module)->Or_type);
- Py_CLEAR(astmodulestate(module)->Param_singleton);
- Py_CLEAR(astmodulestate(module)->Param_type);
Py_CLEAR(astmodulestate(module)->Pass_type);
Py_CLEAR(astmodulestate(module)->Pow_singleton);
Py_CLEAR(astmodulestate(module)->Pow_type);
@@ -556,8 +552,6 @@
Py_VISIT(astmodulestate(module)->Not_type);
Py_VISIT(astmodulestate(module)->Or_singleton);
Py_VISIT(astmodulestate(module)->Or_type);
- Py_VISIT(astmodulestate(module)->Param_singleton);
- Py_VISIT(astmodulestate(module)->Param_type);
Py_VISIT(astmodulestate(module)->Pass_type);
Py_VISIT(astmodulestate(module)->Pow_singleton);
Py_VISIT(astmodulestate(module)->Pow_type);
@@ -1656,11 +1650,6 @@
*)state->AugStore_type, NULL,
NULL);
if (!state->AugStore_singleton) return 0;
- state->Param_type = make_type("Param", state->expr_context_type, NULL, 0);
- if (!state->Param_type) return 0;
- state->Param_singleton = PyType_GenericNew((PyTypeObject
- *)state->Param_type, NULL, NULL);
- if (!state->Param_singleton) return 0;
state->boolop_type = make_type("boolop", state->AST_type, NULL, 0);
if (!state->boolop_type) return 0;
if (!add_attributes(state->boolop_type, NULL, 0)) return 0;
@@ -4474,9 +4463,6 @@
case AugStore:
Py_INCREF(astmodulestate_global->AugStore_singleton);
return astmodulestate_global->AugStore_singleton;
- case Param:
- Py_INCREF(astmodulestate_global->Param_singleton);
- return astmodulestate_global->Param_singleton;
default:
/* should never happen, but just in case ... */
PyErr_Format(PyExc_SystemError, "unknown expr_context found");
@@ -8682,14 +8668,6 @@
*out = AugStore;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Param_type);
- if (isinstance == -1) {
- return 1;
- }
- if (isinstance) {
- *out = Param;
- return 0;
- }
PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj);
return 1;
@@ -10038,10 +10016,6 @@
goto error;
}
Py_INCREF(astmodulestate(m)->AugStore_type);
- if (PyModule_AddObject(m, "Param", astmodulestate_global->Param_type) < 0) {
- goto error;
- }
- Py_INCREF(astmodulestate(m)->Param_type);
if (PyModule_AddObject(m, "boolop", astmodulestate_global->boolop_type) <
0) {
goto error;
diff --git a/Python/ast.c b/Python/ast.c
index 62ee60a..1c1395f 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -75,8 +75,6 @@
return "AugLoad";
case AugStore:
return "AugStore";
- case Param:
- return "Param";
default:
Py_UNREACHABLE();
}
diff --git a/Python/compile.c b/Python/compile.c
index b92cb44..dd14023 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3579,10 +3579,10 @@
case AugStore:
break;
case Del: op = DELETE_DEREF; break;
- case Param:
default:
- PyErr_SetString(PyExc_SystemError,
- "param invalid for deref variable");
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ ctx);
return 0;
}
break;
@@ -3596,10 +3596,10 @@
case AugLoad:
case AugStore:
break;
- case Param:
default:
- PyErr_SetString(PyExc_SystemError,
- "param invalid for local variable");
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ ctx);
return 0;
}
ADDOP_N(c, op, mangled, varnames);
@@ -3614,10 +3614,10 @@
case AugLoad:
case AugStore:
break;
- case Param:
default:
- PyErr_SetString(PyExc_SystemError,
- "param invalid for global variable");
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ ctx);
return 0;
}
break;
@@ -3631,10 +3631,10 @@
case AugLoad:
case AugStore:
break;
- case Param:
default:
- PyErr_SetString(PyExc_SystemError,
- "param invalid for name variable");
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ ctx);
return 0;
}
break;
@@ -5058,10 +5058,10 @@
case Del:
ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names);
break;
- case Param:
default:
- PyErr_SetString(PyExc_SystemError,
- "param invalid in attribute expression");
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ e->v.Attribute.ctx);
return 0;
}
break;
@@ -5359,9 +5359,10 @@
case AugStore:/* fall through to Store */
case Store: op = STORE_SUBSCR; break;
case Del: op = DELETE_SUBSCR; break;
- case Param:
- PyErr_SetString(PyExc_SystemError,
- "param invalid in subscript expression");
+ default:
+ PyErr_Format(PyExc_SystemError,
+ "expr_context kind %d should not be possible",
+ ctx);
return 0;
}
if (ctx == AugStore) {