Skip to content

Commit

Permalink
Changed namespace name to _vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Oct 29, 1997
1 parent c6d686a commit 89757c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions VSEval.py
@@ -1,7 +1,7 @@

"""Very Safe Python Expressions
"""
__rcs_id__='$Id: VSEval.py,v 1.5 1997/10/29 17:00:11 jim Exp $'
__rcs_id__='$Id: VSEval.py,v 1.6 1997/10/29 21:31:02 jim Exp $'

############################################################################
# Copyright
Expand Down Expand Up @@ -55,7 +55,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.5 $'[11:-2]
__version__='$Revision: 1.6 $'[11:-2]

from string import join
import new, sys
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(self, expr, custom=None, globals={'__builtins__':{}}, **kw):
# 'manage'. This is a DC specific rule and probably needs to be
# made customizable!
for name in names:
if name[:1]=='_' and name != '__env__':
if name[:1]=='_' and name != '_' and name != '_vars':
raise TypeError, 'illegal name used in expression'


Expand Down Expand Up @@ -231,14 +231,14 @@ def _push_env(self, out, envpos, names):
# push name of special environment variable, '_env':
if envpos < 0:
envpos=len(names)
names.append('__env__')
names.append('_vars')
out.append(LOAD_NAME)
out.append(envpos%256)
out.append(envpos/256)
return envpos

def eval(self, mapping):
d={'__env__': mapping}
d={'_vars': mapping}
code=self.code
for name in self.used:
try: d[name]=mapping.getitem(name,0)
Expand Down Expand Up @@ -436,6 +436,9 @@ def careful_mul(a,b):
############################################################################
#
# $Log: VSEval.py,v $
# Revision 1.6 1997/10/29 21:31:02 jim
# Changed namespace name to _vars.
#
# Revision 1.5 1997/10/29 17:00:11 jim
# Made namespace, __env__ public.
#
Expand Down

0 comments on commit 89757c5

Please sign in to comment.