Kaydet (Commit) 3c2523c2 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Issue 2903: Add __name__ in globals for namedtuple namespace.

üst d99bee7c
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment