bpo-36187: Remove NamedStore. (GH-12167)

NamedStore has been replaced with Store. The difference between
NamedStore and Store is handled when precess the NamedExpr node
one level upper.
This commit is contained in:
Serhiy Storchaka 2019-03-05 20:42:06 +02:00 committed by GitHub
parent adfffc7343
commit d8b3a98c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 143 deletions

21
Python/Python-ast.c generated
View file

@ -365,8 +365,7 @@ static char *Tuple_fields[]={
};
static PyTypeObject *expr_context_type;
static PyObject *Load_singleton, *Store_singleton, *Del_singleton,
*AugLoad_singleton, *AugStore_singleton, *Param_singleton,
*NamedStore_singleton;
*AugLoad_singleton, *AugStore_singleton, *Param_singleton;
static PyObject* ast2obj_expr_context(expr_context_ty);
static PyTypeObject *Load_type;
static PyTypeObject *Store_type;
@ -374,7 +373,6 @@ static PyTypeObject *Del_type;
static PyTypeObject *AugLoad_type;
static PyTypeObject *AugStore_type;
static PyTypeObject *Param_type;
static PyTypeObject *NamedStore_type;
static PyTypeObject *slice_type;
static PyObject* ast2obj_slice(void*);
static PyTypeObject *Slice_type;
@ -993,10 +991,6 @@ static int init_types(void)
if (!Param_type) return 0;
Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);
if (!Param_singleton) return 0;
NamedStore_type = make_type("NamedStore", expr_context_type, NULL, 0);
if (!NamedStore_type) return 0;
NamedStore_singleton = PyType_GenericNew(NamedStore_type, NULL, NULL);
if (!NamedStore_singleton) return 0;
slice_type = make_type("slice", &AST_type, NULL, 0);
if (!slice_type) return 0;
if (!add_attributes(slice_type, NULL, 0)) return 0;
@ -3657,9 +3651,6 @@ PyObject* ast2obj_expr_context(expr_context_ty o)
case Param:
Py_INCREF(Param_singleton);
return Param_singleton;
case NamedStore:
Py_INCREF(NamedStore_singleton);
return NamedStore_singleton;
default:
/* should never happen, but just in case ... */
PyErr_Format(PyExc_SystemError, "unknown expr_context found");
@ -7608,14 +7599,6 @@ obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
*out = Param;
return 0;
}
isinstance = PyObject_IsInstance(obj, (PyObject *)NamedStore_type);
if (isinstance == -1) {
return 1;
}
if (isinstance) {
*out = NamedStore;
return 0;
}
PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj);
return 1;
@ -8828,8 +8811,6 @@ PyInit__ast(void)
return NULL;
if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "NamedStore", (PyObject*)NamedStore_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return