Skip to content

Commit

Permalink
Merge branch 'py36' into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
vrthra committed Feb 12, 2018
2 parents 16da483 + 5fce7b9 commit 59f9eb4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions byterun/pyvm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ def byte_BUILD_TUPLE_UNPACK_WITH_CALL(self, count):
# This is similar to BUILD_TUPLE_UNPACK, but is used for f(*x, *y, *z)
# call syntax. The stack item at position count + 1 should be the
# corresponding callable f.
elts = self.popn(count)
self.push(tuple(e for l in elts for e in l))
self.byte_BUILD_TUPLE_UNPACK(count)


def byte_BUILD_TUPLE_UNPACK(self, count):
# Pops count iterables from the stack, joins them in a single tuple,
Expand All @@ -613,6 +613,10 @@ def byte_BUILD_TUPLE(self, count):
elts = self.popn(count)
self.push(tuple(elts))

def byte_BUILD_LIST_UNPACK(self, count):
elts = self.popn(count)
self.push([e for l in elts for e in l])

def byte_BUILD_LIST(self, count):
elts = self.popn(count)
self.push(elts)
Expand All @@ -633,14 +637,14 @@ def byte_BUILD_CONST_KEY_MAP(self, count):

def byte_BUILD_MAP(self, count):
# Pushes a new dictionary on to stack.
if not(six.PY3 and sys.version_info.minor >= 5):
if sys.version_info[:2] < (3, 5):
self.push({})
return
# Pop 2*count items so that
# dictionary holds count entries: {..., TOS3: TOS2, TOS1:TOS}
# updated in version 3.5
kvs = {}
for i in range(0, count):
for i in range(count):
key, val = self.popn(2)
kvs[key] = val
self.push(kvs)
Expand Down Expand Up @@ -1063,7 +1067,7 @@ def byte_CALL_FUNCTION_VAR(self, arg):
def byte_CALL_FUNCTION_KW(self, argc):
if not(six.PY3 and sys.version_info.minor >= 6):
kwargs = self.pop()
return self.call_function(arg, [], kwargs)
return self.call_function(argc, [], kwargs)
# changed in 3.6: keyword arguments are packed in a tuple instead
# of a dict. argc indicates total number of args.
kwargnames = self.pop()
Expand Down

0 comments on commit 59f9eb4

Please sign in to comment.