From: Fabian Seoane <fab...@fseoane.net> This could represent a security risk if sympy was allowed to run in a 'safe' environment in which sympy was the only module allowed to be imported since you could have access to the os module at sympy.os. Currently django-sympy works this way, althought it is planned to change. It is no problem for apps that run on the googleapp engine, since the python interpreter they run on has no os module. --- sympy/__init__.py | 8 ++++++-- sympy/core/cache.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/sympy/__init__.py b/sympy/__init__.py index cbea406..864f82f 100644 --- a/sympy/__init__.py +++ b/sympy/__init__.py @@ -12,8 +12,12 @@ __version__ = "0.6.3-hg" -import os -SYMPY_DEBUG = eval(os.getenv('SYMPY_DEBUG', 'False')) + +def __sympy_debug(): + # helper function so we don't import os globally + import os + return eval(os.getenv('SYMPY_DEBUG', 'False')) +SYMPY_DEBUG = __sympy_debug() import symbol as stdlib_symbol from sympy.core import * diff --git a/sympy/core/cache.py b/sympy/core/cache.py index 93ef1d0..fbe2f0f 100644 --- a/sympy/core/cache.py +++ b/sympy/core/cache.py @@ -312,8 +312,10 @@ def wrapper(*args, **kw_args): # SYMPY_USE_CACHE=yes/no/debug -import os -usecache = os.getenv('SYMPY_USE_CACHE', 'yes').lower() +def __usecache(): + import os + return os.getenv('SYMPY_USE_CACHE', 'yes').lower() +usecache = __usecache() if usecache=='no': Memoizer = Memoizer_nocache -- 1.6.1.2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---