[ZCM] [ZC] 2295/ 2 Comment "PythonScript comments cause syntax error"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 22 Jun 2007 12:08:17 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2295 Update (Comment) "PythonScript comments cause syntax error"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2295

==============================================================
= Comment - Entry #2 by wlang on Jun 22, 2007 12:08 pm


Uploaded:  "synterr.patch"
 - http://www.zope.org/Collectors/Zope/2295/synterr.patch/view
This bug was introduced with issue 2061 (zope-2.9.3). The '\n'.join(body.splitlines()) dance removes the last newline. This, in turn, causes the failure of the restricted python compiler. I have no idea, why the last newline is necessary, but adding it, makes the example working again.

See attached patch.
________________________________________
= Request - Entry #1 by bacarter on Mar 21, 2007 6:30 pm

A bare conditional in a python script followed by a comment causes a syntax error.  This same code is legal python.

Example:
if False:
  pass
#hi

==============================================================