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

Andreas Jung andreas at andreas-jung.com
Sat Jun 23 03:28:52 EDT 2007


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

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

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt	2007-06-23 04:20:55 UTC (rev 76953)
+++ Zope/branches/2.10/doc/CHANGES.txt	2007-06-23 07:28:52 UTC (rev 76954)
@@ -4,10 +4,13 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
-  Zope 2.10.4 (unreleased)
+  Zope 2.10.4 (23.06.2007)
 
     Bugs fixed
 
+      - Collector #2295: Comments in PythonScripts could lead to syntax
+        errors
+
       - Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
 
       - Collector #2304: fixed markup issue in ptEdit.zpt

Modified: Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-06-23 04:20:55 UTC (rev 76953)
+++ Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-06-23 07:28:52 UTC (rev 76954)
@@ -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.10/lib/python/RestrictedPython/RCompile.py
===================================================================
--- Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py	2007-06-23 04:20:55 UTC (rev 76953)
+++ Zope/branches/2.10/lib/python/RestrictedPython/RCompile.py	2007-06-23 07:28:52 UTC (rev 76954)
@@ -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