summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-09-25 23:31:52 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-09-25 23:31:52 (GMT)
commit6ee7bc04f7d095bd7a2860a4fb9da331fa908ecd (patch)
tree4c86dc3c9881da87206f960f30262c258a779f70 /Lib/collections.py
parent17617a07d1f2d2ffb6b0f77be8926f54cd0f4ae8 (diff)
downloadcpython-6ee7bc04f7d095bd7a2860a4fb9da331fa908ecd.zip
cpython-6ee7bc04f7d095bd7a2860a4fb9da331fa908ecd.tar.gz
cpython-6ee7bc04f7d095bd7a2860a4fb9da331fa908ecd.tar.bz2
Fix namedtuple bug reported by Glenn Linderman. Template did not form correctly if the field names were input in Unicode.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 2408818..ace2b2a 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -38,7 +38,7 @@ def namedtuple(typename, field_names, verbose=False):
# generating informative error messages and preventing template injection attacks.
if isinstance(field_names, basestring):
field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas
- field_names = tuple(field_names)
+ field_names = tuple(map(str, field_names))
for name in (typename,) + field_names:
if not all(c.isalnum() or c=='_' for c in name):
raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name)