[Python-checkins] r63807 - python/trunk/Lib/collections.py

raymond.hettinger python-checkins at python.org
Fri May 30 09:16:53 CEST 2008


Author: raymond.hettinger
Date: Fri May 30 09:16:53 2008
New Revision: 63807

Log:
Issue 2903:  Add __name__ in globals for namedtuple namespace.

Modified:
   python/trunk/Lib/collections.py

Modified: python/trunk/Lib/collections.py
==============================================================================
--- python/trunk/Lib/collections.py	(original)
+++ python/trunk/Lib/collections.py	Fri May 30 09:16:53 2008
@@ -88,8 +88,9 @@
     if verbose:
         print template
 
-    # Execute the template string in a temporary namespace
-    namespace = dict(itemgetter=_itemgetter)
+    # Execute the template string in a temporary namespace and
+    # support tracing utilities by setting a value for frame.f_globals['__name__']
+    namespace = dict(itemgetter=_itemgetter, __name__='namedtuple_%s' % typename)
     try:
         exec template in namespace
     except SyntaxError, e:


More information about the Python-checkins mailing list