diff Lib/collections.py @ 49301:f323fa4e48d7 legacy-trunk

Fix namedtuple bug reported by Glenn Linderman. Template did not form correctly if the field names were input in Unicode.
author Raymond Hettinger <python@rcn.com>
date Thu, 25 Sep 2008 23:31:52 +0000
parents 246a802637ad
children e718d29874d7 5934612d5070
line wrap: on
line diff
--- a/Lib/collections.py	Thu Sep 25 20:52:56 2008 +0000
+++ b/Lib/collections.py	Thu Sep 25 23:31:52 2008 +0000
@@ -38,7 +38,7 @@
     # 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)