[Python-checkins] r50924 - in python/trunk: Lib/compiler/transformer.py Lib/test/test_compiler.py Misc/NEWS

georg.brandl python-checkins at python.org
Sat Jul 29 11:33:28 CEST 2006


Author: georg.brandl
Date: Sat Jul 29 11:33:26 2006
New Revision: 50924

Modified:
   python/trunk/Lib/compiler/transformer.py
   python/trunk/Lib/test/test_compiler.py
   python/trunk/Misc/NEWS
Log:
Bug #1441397: The compiler module now recognizes module and function
docstrings correctly as it did in Python 2.4.


Modified: python/trunk/Lib/compiler/transformer.py
==============================================================================
--- python/trunk/Lib/compiler/transformer.py	(original)
+++ python/trunk/Lib/compiler/transformer.py	Sat Jul 29 11:33:26 2006
@@ -1382,6 +1382,7 @@
     symbol.testlist,
     symbol.testlist_safe,
     symbol.test,
+    symbol.or_test,
     symbol.and_test,
     symbol.not_test,
     symbol.comparison,

Modified: python/trunk/Lib/test/test_compiler.py
==============================================================================
--- python/trunk/Lib/test/test_compiler.py	(original)
+++ python/trunk/Lib/test/test_compiler.py	Sat Jul 29 11:33:26 2006
@@ -68,6 +68,14 @@
     def testDefaultArgs(self):
         self.assertRaises(SyntaxError, compiler.parse, "def foo(a=1, b): pass")
 
+    def testDocstrings(self):
+        c = compiler.compile('"doc"', '<string>', 'exec')
+        self.assert_('__doc__' in c.co_names)
+        c = compiler.compile('def f():\n "doc"', '<string>', 'exec')
+        g = {}
+        exec c in g
+        self.assertEquals(g['f'].__doc__, "doc")
+
     def testLineNo(self):
         # Test that all nodes except Module have a correct lineno attribute.
         filename = __file__

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sat Jul 29 11:33:26 2006
@@ -52,6 +52,9 @@
 Library
 -------
 
+- Bug #1441397: The compiler module now recognizes module and function
+  docstrings correctly as it did in Python 2.4.
+
 - Bug #1529297:  The rewrite of doctest for Python 2.4 unintentionally
   lost that tests are sorted by name before being run.  This rarely
   matters for well-written tests, but can create baffling symptoms if


More information about the Python-checkins mailing list