Mercurial > cpython-lru_cache-weakref
comparison Python/Python-ast.c @ 71463:7a72068d88fe 2.7
allow None identifiers
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 22 Jul 2011 17:20:58 -0500 |
| parents | a21829180423 |
| children | a9341ce35abc |
comparison
equal
deleted
inserted
replaced
| 71453:c6e63c67efd5 | 71463:7a72068d88fe |
|---|---|
| 1 /* File automatically generated by Parser/asdl_c.py. */ | 1 /* File automatically generated by Parser/asdl_c.py. */ |
| 2 | 2 |
| 3 | 3 |
| 4 /* | 4 /* |
| 5 __version__ . | 5 __version__ 82160. |
| 6 | 6 |
| 7 This module must be committed separately after each AST grammar change; | 7 This module must be committed separately after each AST grammar change; |
| 8 The __version__ number is set to the revision number of the commit | 8 The __version__ number is set to the revision number of the commit |
| 9 containing the grammar change. | 9 containing the grammar change. |
| 10 */ | 10 */ |
| 594 return 0; | 594 return 0; |
| 595 } | 595 } |
| 596 | 596 |
| 597 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) | 597 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) |
| 598 { | 598 { |
| 599 if (!PyString_CheckExact(obj)) { | 599 if (!PyString_CheckExact(obj) && obj != Py_None) { |
| 600 PyErr_Format(PyExc_TypeError, | 600 PyErr_Format(PyExc_TypeError, |
| 601 "AST identifier must be of type str"); | 601 "AST identifier must be of type str"); |
| 602 return 1; | 602 return 1; |
| 603 } | 603 } |
| 604 return obj2ast_object(obj, out, arena); | 604 return obj2ast_object(obj, out, arena); |
| 6585 if (!m) return; | 6585 if (!m) return; |
| 6586 d = PyModule_GetDict(m); | 6586 d = PyModule_GetDict(m); |
| 6587 if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; | 6587 if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; |
| 6588 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) | 6588 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) |
| 6589 return; | 6589 return; |
| 6590 if (PyModule_AddStringConstant(m, "__version__", "") < 0) | 6590 if (PyModule_AddStringConstant(m, "__version__", "82160") < 0) |
| 6591 return; | 6591 return; |
| 6592 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; | 6592 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; |
| 6593 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) | 6593 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) |
| 6594 return; | 6594 return; |
| 6595 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) | 6595 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) |
