Commit 50c33616 authored by Andreas Jung's avatar Andreas Jung

- Collector #2295: Comments in PythonScripts could lead to syntax

        errors
parent 44d8608e
...@@ -4,10 +4,13 @@ Zope Changes ...@@ -4,10 +4,13 @@ Zope Changes
Change information for previous versions of Zope can be found in the Change information for previous versions of Zope can be found in the
file HISTORY.txt. file HISTORY.txt.
Zope 2.9.8 (unreleased) Zope 2.9.8 (24.06.2007)
Bugs fixed Bugs fixed
- Collector #2295: Comments in PythonScripts could lead to syntax
errors
- Collector #2307: ObjectCopiedEvent not dispatched to sublocations. - Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
- Fixed ZClass test breakage due to non-pickleability of - Fixed ZClass test breakage due to non-pickleability of
......
...@@ -128,6 +128,9 @@ class TestPythonScriptNoAq(PythonScriptTestBase): ...@@ -128,6 +128,9 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
res = self._newPS('return 1 * 5 + 4 / 2 - 6')() res = self._newPS('return 1 * 5 + 4 / 2 - 6')()
self.assertEqual(res, 1) self.assertEqual(res, 1)
def testCollector2295(self):
res = self._newPS('if False:\n pass\n#hi')
def testReduce(self): def testReduce(self):
res = self._newPS('return reduce(lambda x, y: x + y, [1,3,5,7])')() res = self._newPS('return reduce(lambda x, y: x + y, [1,3,5,7])')()
self.assertEqual(res, 16) self.assertEqual(res, 16)
......
...@@ -43,7 +43,7 @@ class RestrictedCompileMode(AbstractCompileMode): ...@@ -43,7 +43,7 @@ class RestrictedCompileMode(AbstractCompileMode):
def __init__(self, source, filename): def __init__(self, source, filename):
if source: if source:
source = '\n'.join(source.splitlines()) source = '\n'.join(source.splitlines()) + '\n'
self.rm = RestrictionMutator() self.rm = RestrictionMutator()
AbstractCompileMode.__init__(self, source, filename) AbstractCompileMode.__init__(self, source, filename)
...@@ -209,7 +209,7 @@ class RFunction(RModule): ...@@ -209,7 +209,7 @@ class RFunction(RModule):
def __init__(self, p, body, name, filename, globals): def __init__(self, p, body, name, filename, globals):
self.params = p self.params = p
if body: if body:
body = '\n'.join(body.splitlines()) body = '\n'.join(body.splitlines()) + '\n'
self.body = body self.body = body
self.name = name self.name = name
self.globals = globals or [] self.globals = globals or []
......
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