[Checkins] SVN: RestrictedPython/trunk/src/RestrictedPython/tests/testRestrictions.py - Collector #2295: Comments in PythonScripts could lead to syntax

Andreas Jung andreas at andreas-jung.com
Sat Jun 23 03:42:34 EDT 2007


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

Changed:
  U   RestrictedPython/trunk/src/RestrictedPython/tests/testRestrictions.py

-=-
Modified: RestrictedPython/trunk/src/RestrictedPython/tests/testRestrictions.py
===================================================================
--- RestrictedPython/trunk/src/RestrictedPython/tests/testRestrictions.py	2007-06-23 07:40:14 UTC (rev 76958)
+++ RestrictedPython/trunk/src/RestrictedPython/tests/testRestrictions.py	2007-06-23 07:42:33 UTC (rev 76959)
@@ -527,6 +527,17 @@
         # parse() is called, then you'll get a syntax error.
         gen.parse()
 
+    def checkCollector2295(self):
+        from RestrictedPython.RCompile import RestrictedCompileMode
+        gen = RestrictedCompileMode(
+            'if False:\n  pass\n# Me Grok, Say Hi',
+            '<testing>'
+            )
+        gen.mode='exec'
+        # if the source has any line ending other than \n by the time
+        # parse() is called, then you'll get a syntax error.
+        gen.parse()
+
         
 create_rmodule()
 



More information about the Checkins mailing list