defining ``COUNT_ALLOCS`` macro.
(Contributed by Victor Stinner in :issue:`39489`.)
-* The ``ast.Suite`` node class has been removed due to no longer being needed.
- (Contributed by Batuhan Taskaya in :issue:`39639`.)
+* The ``ast.Suite`` and ``ast.Param`` node classes has been removed due to no
+ longer being needed.
+ (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:`39969`.)
Porting to Python 3.9
typedef struct _expr *expr_ty;
-typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
- Param=6 } expr_context_ty;
+typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5 }
+ expr_context_ty;
typedef enum _boolop { And=1, Or=2 } boolop_ty;
--- /dev/null
+Remove ``ast.Param`` node class because it's no longer used. Patch by
+Batuhan Taskaya.
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
- expr_context = Load | Store | Del | AugLoad | AugStore | Param
+ expr_context = Load | Store | Del | AugLoad | AugStore
boolop = And | Or
PyObject *Not_type;
PyObject *Or_singleton;
PyObject *Or_type;
- PyObject *Param_singleton;
- PyObject *Param_type;
PyObject *Pass_type;
PyObject *Pow_singleton;
PyObject *Pow_type;
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);
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);
*)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;
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");
*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;
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;
return "AugLoad";
case AugStore:
return "AugStore";
- case Param:
- return "Param";
default:
Py_UNREACHABLE();
}
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;
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);
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;
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;
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;
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) {