[ZCM] [ZC] 2295/ 3 Resolve "PythonScript comments cause syntax error"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sat, 23 Jun 2007 06:45:19 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2295 Update (Resolve) "PythonScript comments cause syntax error"
 Status Resolved, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2295

==============================================================
= Resolve - Entry #3 by ajung on Jun 23, 2007 6:45 am

 Status: Pending => Resolved

Patch applied to 2.9, 2.10 branch, trunk (RestrictedPython/trunk).
________________________________________
= 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

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