Permalink
Browse files

byterun: Get rid of unused func_locals member of Function.

This was an oversight in the original byterun.
  • Loading branch information...
Andy Chu
Andy Chu committed Apr 8, 2018
1 parent 23fa21f commit b5d0bb3155a1fa6cda85ddcd76bb9e02346a072f
Showing with 4 additions and 8 deletions.
  1. +2 −3 opy/byterun/pyobj.py
  2. +2 −5 opy/byterun/pyvm2.py
View
@@ -32,18 +32,17 @@ class Function(object):
__slots__ = [
'func_code', 'func_name', 'func_defaults', 'func_globals',
'func_locals', 'func_dict', 'func_closure',
'func_dict', 'func_closure',
'__name__', '__dict__', '__doc__',
'_vm', '_func',
]
def __init__(self, name, code, globs, locs, defaults, closure, vm):
def __init__(self, name, code, globs, defaults, closure, vm):
self._vm = vm
self.func_code = code
self.func_name = self.__name__ = name or code.co_name
self.func_defaults = tuple(defaults)
self.func_globals = globs
self.func_locals = locs
self.__dict__ = {}
self.func_closure = closure
self.__doc__ = code.co_consts[0] if code.co_consts else None
View
@@ -816,8 +816,7 @@ def byte_MAKE_FUNCTION(self, argc):
code = self.pop()
defaults = self.popn(argc)
globs = self.frame.f_globals
locs = self.frame.f_locals
fn = Function(name, code, globs, locs, defaults, None, self)
fn = Function(name, code, globs, defaults, None, self)
self.push(fn)
def byte_LOAD_CLOSURE(self, name):
@@ -828,8 +827,7 @@ def byte_MAKE_CLOSURE(self, argc):
closure, code = self.popn(2)
defaults = self.popn(argc)
globs = self.frame.f_globals
locs = self.frame.f_locals
fn = Function(name, code, globs, locs, defaults, closure, self)
fn = Function(name, code, globs, defaults, closure, self)
self.push(fn)
def byte_CALL_FUNCTION(self, arg):
@@ -944,7 +942,6 @@ def call_function(self, arg, args, kwargs):
defaults = func.func_defaults or ()
byterun_func = Function(
func.func_name, func.func_code, func.func_globals,
self.frame.f_locals, # Is this right? How does it work?
defaults, func.func_closure, self)
else:
byterun_func = func

0 comments on commit b5d0bb3

Please sign in to comment.