[Zope-Checkins] SVN: Zope/branches/2.9/ - Collector #2295: Comments in PythonScripts could lead to syntax

Andreas Jung andreas at andreas-jung.com
Sat Jun 23 03:30:21 EDT 2007


Log message for revision 76955:
        - Collector #2295: Comments in PythonScripts could lead to syntax
          errors
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
  U   Zope/branches/2.9/lib/python/RestrictedPython/RCompile.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.9/doc/CHANGES.txt	2007-06-23 07:28:52 UTC (rev 76954)
+++ Zope/branches/2.9/doc/CHANGES.txt	2007-06-23 07:30:20 UTC (rev 76955)
@@ -4,10 +4,13 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
-  Zope 2.9.8 (unreleased)
+  Zope 2.9.8 (24.06.2007)
 
    Bugs fixed
 
+      - Collector #2295: Comments in PythonScripts could lead to syntax
+        errors
+
       - Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
 
       - Fixed ZClass test breakage due to non-pickleability of

Modified: Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-06-23 07:28:52 UTC (rev 76954)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-06-23 07:30:20 UTC (rev 76955)
@@ -128,6 +128,9 @@
         res = self._newPS('return 1 * 5 + 4 / 2 - 6')()
         self.assertEqual(res, 1)
 
+    def testCollector2295(self):
+        res = self._newPS('if False:\n  pass\n#hi')
+
     def testReduce(self):
         res = self._newPS('return reduce(lambda x, y: x + y, [1,3,5,7])')()
         self.assertEqual(res, 16)

Modified: Zope/branches/2.9/lib/python/RestrictedPython/RCompile.py
===================================================================
--- Zope/branches/2.9/lib/python/RestrictedPython/RCompile.py	2007-06-23 07:28:52 UTC (rev 76954)
+++ Zope/branches/2.9/lib/python/RestrictedPython/RCompile.py	2007-06-23 07:30:20 UTC (rev 76955)
@@ -43,7 +43,7 @@
 
     def __init__(self, source, filename):
         if source:
-            source = '\n'.join(source.splitlines())
+            source = '\n'.join(source.splitlines()) + '\n'
         self.rm = RestrictionMutator()
         AbstractCompileMode.__init__(self, source, filename)
 
@@ -209,7 +209,7 @@
     def __init__(self, p, body, name, filename, globals):
         self.params = p
         if body:
-            body = '\n'.join(body.splitlines())
+            body = '\n'.join(body.splitlines()) + '\n' 
         self.body = body
         self.name = name
         self.globals = globals or []



More information about the Zope-Checkins mailing list