bpo-39999: Improve compatibility of the ast module. (GH-19056)

* Re-add removed classes Suite, slice, Param, AugLoad and AugStore.
* Add docstrings for dummy classes.
* Add docstrings for attribute aliases.
* Set __module__ to "ast" instead of "_ast".
This commit is contained in:
Serhiy Storchaka 2020-03-22 20:33:34 +02:00 • committed by GitHub
parent 044cf94f61
commit bace59d8b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 22 deletions

View file

@ -774,7 +774,7 @@ static PyType_Slot AST_type_slots[] = {
};
static PyType_Spec AST_type_spec = {
"_ast.AST",
"ast.AST",
sizeof(AST_object),
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
@ -800,7 +800,7 @@ make_type(const char *type, PyObject* base, const char* const* fields, int num_f
type, base,
astmodulestate_global->_fields, fnames,
astmodulestate_global->__module__,
astmodulestate_global->_ast,
astmodulestate_global->ast,
astmodulestate_global->__doc__, doc);
Py_DECREF(fnames);
return result;
@ -1302,7 +1302,7 @@ def generate_module_def(f, mod):
visitor_list.add(visitor)
state_strings = {
"_ast",
"ast",
"_fields",
"__doc__",
"__dict__",