mirror of https://github.com/python/cpython
Fix off-by-one errors in code to find depth of stack.
XXX The code is still widely inaccurate, but most (all?) of the time it's an overestimate.
This commit is contained in:
parent
87797872a8
commit
4ba9001f5c
|
@ -764,11 +764,11 @@ class StackDepthTracker:
|
|||
# UNPACK_SEQUENCE, BUILD_TUPLE,
|
||||
# BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE
|
||||
def UNPACK_SEQUENCE(self, count):
|
||||
return count
|
||||
return count-1
|
||||
def BUILD_TUPLE(self, count):
|
||||
return -count
|
||||
return -count+1
|
||||
def BUILD_LIST(self, count):
|
||||
return -count
|
||||
return -count+1
|
||||
def CALL_FUNCTION(self, argc):
|
||||
hi, lo = divmod(argc, 256)
|
||||
return lo + hi * 2
|
||||
|
|
|
@ -764,11 +764,11 @@ class StackDepthTracker:
|
|||
# UNPACK_SEQUENCE, BUILD_TUPLE,
|
||||
# BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE
|
||||
def UNPACK_SEQUENCE(self, count):
|
||||
return count
|
||||
return count-1
|
||||
def BUILD_TUPLE(self, count):
|
||||
return -count
|
||||
return -count+1
|
||||
def BUILD_LIST(self, count):
|
||||
return -count
|
||||
return -count+1
|
||||
def CALL_FUNCTION(self, argc):
|
||||
hi, lo = divmod(argc, 256)
|
||||
return lo + hi * 2
|
||||
|
|
Loading…
Reference in New Issue