]> granicus.if.org Git - python/commitdiff
allow None identifiers
authorBenjamin Peterson <benjamin@python.org>
Fri, 22 Jul 2011 22:20:58 +0000 (17:20 -0500)
committerBenjamin Peterson <benjamin@python.org>
Fri, 22 Jul 2011 22:20:58 +0000 (17:20 -0500)
Parser/asdl_c.py
Python/Python-ast.c

index 8aba6b3c65f7e3a7576c7cb9574115e5fd5db0d7..6a465490b6a833b31b9b4f40409fa4bc0d0a24a3 100755 (executable)
@@ -802,7 +802,7 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
 
 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
 {
-    if (!PyString_CheckExact(obj)) {
+    if (!PyString_CheckExact(obj) && obj != Py_None) {
         PyErr_Format(PyExc_TypeError,
                     "AST identifier must be of type str");
         return 1;
index 91ad3ad99cd5c00d1696568b5cb676d6d9d05936..dcfde3c349ba18eee31f51943dcbcfeec4de669a 100644 (file)
@@ -2,7 +2,7 @@
 
 
 /*
-   __version__ .
+   __version__ 82160.
 
    This module must be committed separately after each AST grammar change;
    The __version__ number is set to the revision number of the commit
@@ -596,7 +596,7 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
 
 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
 {
-    if (!PyString_CheckExact(obj)) {
+    if (!PyString_CheckExact(obj) && obj != Py_None) {
         PyErr_Format(PyExc_TypeError,
                     "AST identifier must be of type str");
         return 1;
@@ -6587,7 +6587,7 @@ init_ast(void)
         if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return;
         if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
                 return;
-        if (PyModule_AddStringConstant(m, "__version__", "") < 0)
+        if (PyModule_AddStringConstant(m, "__version__", "82160") < 0)
                 return;
         if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
         if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)