mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
This commit is contained in:
parent
09ad17810c
commit
f8cb8a16a3
45 changed files with 3242 additions and 1308 deletions
|
|
@ -937,11 +937,17 @@ Py_GetPythonHome(void)
|
|||
static void
|
||||
initmain(PyInterpreterState *interp)
|
||||
{
|
||||
PyObject *m, *d, *loader;
|
||||
PyObject *m, *d, *loader, *ann_dict;
|
||||
m = PyImport_AddModule("__main__");
|
||||
if (m == NULL)
|
||||
Py_FatalError("can't create __main__ module");
|
||||
d = PyModule_GetDict(m);
|
||||
ann_dict = PyDict_New();
|
||||
if ((ann_dict == NULL) ||
|
||||
(PyDict_SetItemString(d, "__annotations__", ann_dict) < 0)) {
|
||||
Py_FatalError("Failed to initialize __main__.__annotations__");
|
||||
}
|
||||
Py_DECREF(ann_dict);
|
||||
if (PyDict_GetItemString(d, "__builtins__") == NULL) {
|
||||
PyObject *bimod = PyImport_ImportModule("builtins");
|
||||
if (bimod == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue