[Python-checkins] cpython (2.7): allow None identifiers
benjamin.peterson
python-checkins at python.org
Sat Jul 23 00:21:53 CEST 2011
http://hg.python.org/cpython/rev/7a72068d88fe
changeset: 71463:7a72068d88fe
branch: 2.7
parent: 71453:c6e63c67efd5
user: Benjamin Peterson <benjamin at python.org>
date: Fri Jul 22 17:20:58 2011 -0500
summary:
allow None identifiers
files:
Parser/asdl_c.py | 2 +-
Python/Python-ast.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -802,7 +802,7 @@
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;
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -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_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 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list