diff options
author | Raymond Hettinger <python@rcn.com> | 2008-05-30 07:16:53 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-05-30 07:16:53 (GMT) |
commit | 3c2523c2eb9de8a05e00c08e83f6b2165020c627 (patch) | |
tree | 35d41d33b72f1bd2e3fbb0184797a6e7748d9426 | |
parent | d99bee7c9fb1211efc8e8e85083f0ca46c784500 (diff) | |
download | cpython-3c2523c2eb9de8a05e00c08e83f6b2165020c627.zip cpython-3c2523c2eb9de8a05e00c08e83f6b2165020c627.tar.gz cpython-3c2523c2eb9de8a05e00c08e83f6b2165020c627.tar.bz2 |
Issue 2903: Add __name__ in globals for namedtuple namespace.
-rw-r--r-- | Lib/collections.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index b03a733..f6233a7 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -88,8 +88,9 @@ def namedtuple(typename, field_names, verbose=False): 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: |