Commit 19a5b07c authored by Boxiang Sun's avatar Boxiang Sun

Enable part of this code because Pyston support co_names now.

We have to support self.used. This part of code was disabled
because Pyston didn't support co_names. Now enable it. But Pyston's
bytecode is different than CPython bytecode. So we can't use the code
which rely on co_code part.
parent ffbdc730
......@@ -72,11 +72,11 @@ class RestrictionCapableEval:
if self.ucode is None:
# Use the standard compiler.
co = compile(self.expr, '<string>', 'eval')
# Pyston change: return code directly
# if self.used is None:
# # Examine the code object, discovering which names
# # the expression needs.
# names=list(co.co_names)
if self.used is None:
# Examine the code object, discovering which names
# the expression needs.
names=list(co.co_names)
# Pyston change: Pyston use different bytecode system than CPython
# used={}
# i=0
# code=co.co_code
......@@ -92,6 +92,7 @@ class RestrictionCapableEval:
# elif c >= HAVE_ARGUMENT: i=i+3
# else: i=i+1
# self.used=tuple(used.keys())
self.used=tuple(names)
self.ucode=co
def eval(self, mapping):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment