From ec2addf0ef5af9f9f2eaef9b2b918724b5b71b38 Mon Sep 17 00:00:00 2001 From: Massimo DiPierro Date: Sat, 3 Dec 2011 00:35:16 -0600 Subject: [PATCH] http://code.google.com/p/web2py/issues/detail?id=464, thanks alwassoc --- VERSION | 2 +- gluon/compileapp.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index eb38928b..9415fb58 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.3 (2011-12-03 00:25:21) dev +Version 1.99.3 (2011-12-03 00:35:14) dev diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 1b7052fa..8f05e175 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -40,12 +40,15 @@ import imp import logging logger = logging.getLogger("web2py") import rewrite +import platform try: import py_compile except: logger.warning('unable to import py_compile') +is_pypy = True if platform.python_implementation() == 'PyPy' else False +settings.global_settings.is_pypy = is_pypy is_gae = settings.global_settings.web2py_runtime_gae is_jython = settings.global_settings.is_jython = 'java' in sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or str(sys.copyright).find('Jython') > 0 @@ -344,6 +347,8 @@ def build_environment(request, response, session, store_current=True): global __builtins__ if is_jython: # jython hack __builtins__ = mybuiltin() + elif is_pypy: # apply the same hack to pypy too + __builtins__ = mybuiltin() else: __builtins__['__import__'] = __builtin__.__import__ ### WHY? environment['__builtins__'] = __builtins__