From: Jeremy Hylton Date: Wed, 29 Aug 2001 20:55:17 +0000 (+0000) Subject: Fix off-by-one errors in code to find depth of stack. X-Git-Tag: v2.2a3~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ba9001f5c9ecb144d1a63782a3fd5cd3646587a;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py index b2f91aad1f92..413a954afd07 100644 --- a/Lib/compiler/pyassem.py +++ b/Lib/compiler/pyassem.py @@ -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 diff --git a/Tools/compiler/compiler/pyassem.py b/Tools/compiler/compiler/pyassem.py index b2f91aad1f92..413a954afd07 100644 --- a/Tools/compiler/compiler/pyassem.py +++ b/Tools/compiler/compiler/pyassem.py @@ -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