[Python-checkins] r69014 - in python/trunk: Lib/collections.py Misc/NEWS

raymond.hettinger python-checkins at python.org
Tue Jan 27 11:03:04 CET 2009


Author: raymond.hettinger
Date: Tue Jan 27 11:03:04 2009
New Revision: 69014

Log:
Issue 5021: doctest.testfile should set __name__

Modified:
   python/trunk/Lib/collections.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/collections.py
==============================================================================
--- python/trunk/Lib/collections.py	(original)
+++ python/trunk/Lib/collections.py	Tue Jan 27 11:03:04 2009
@@ -109,7 +109,7 @@
     # where the named tuple is created.  Bypass this step in enviroments where
     # sys._getframe is not defined (Jython for example).
     if hasattr(_sys, '_getframe'):
-        result.__module__ = _sys._getframe(1).f_globals['__name__']
+        result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')
 
     return result
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Jan 27 11:03:04 2009
@@ -145,6 +145,9 @@
 Library
 -------
 
+- Issue 5021:  doctest.testfile() did not create __name__ and
+  collections.namedtuple() relied on __name__ being defined.
+
 - Backport importlib from Python 3.1. Only the import_module() function has
   been backported to help facilitate transitions from 2.7 to 3.1.
 


More information about the Python-checkins mailing list