[Zope-Checkins] CVS: Zope/lib/python/RestrictedPython - SelectCompiler.py:1.3

Brian Lloyd brian@digicool.com
Sat, 22 Dec 2001 11:39:05 -0500


Update of /cvs-repository/Zope/lib/python/RestrictedPython
In directory cvs.zope.org:/tmp/cvs-serv4739

Modified Files:
	SelectCompiler.py 
Log Message:
Merge compiler selection fix from 2.5 branch.


=== Zope/lib/python/RestrictedPython/SelectCompiler.py 1.2 => 1.3 ===
 '''
 
-try:
-    import compiler  # Should only be found if Python >= 2.2.
-except ImportError:
+import sys
+
+if sys.version_info[1] < 2:
     # Use the compiler_2_1 package.
     from compiler_2_1 import ast
     from compiler_2_1.transformer import parse
@@ -30,6 +30,7 @@
          compile_restricted_eval
 else:
     # Use the compiler from the standard library.
+    import compiler
     from compiler import ast
     from compiler.transformer import parse
     from compiler.consts import OP_ASSIGN, OP_DELETE, OP_APPLY