From 4cdcf8eae0ea7b4a1248d56d8273f854e600c50c Mon Sep 17 00:00:00 2001 From: ilvalle Date: Sun, 26 Jun 2016 18:16:56 +0200 Subject: [PATCH] Since py2.7 compile() supports Win and Mac newlines. Also input in 'exec' mode does not have to end in a newline anymore. --- gluon/restricted.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gluon/restricted.py b/gluon/restricted.py index 278b3a47..c67bcbf4 100644 --- a/gluon/restricted.py +++ b/gluon/restricted.py @@ -199,11 +199,7 @@ class RestrictedError(Exception): def compile2(code, layer): - """ - The ``+'\\n'`` is necessary else compile fails when code ends in a comment. - """ - - return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec') + return compile(code.rstrip(), layer, 'exec') def restricted(code, environment=None, layer='Unknown'):