]> granicus.if.org Git - python/commitdiff
bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX (GH-219)
authorINADA Naoki <methane@users.noreply.github.com>
Tue, 21 Feb 2017 17:33:24 +0000 (02:33 +0900)
committerGitHub <noreply@github.com>
Tue, 21 Feb 2017 17:33:24 +0000 (02:33 +0900)
(cherry picked from commit 3a9ac827c7c87dffc60c4200323948551bcb6662)

Misc/NEWS
Python/compile.c

index 83b316c644d72bc61e3ce8f0dc5bd51af6e5b550..5688883375824e4b622a70015f4a212d3e0c9102 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.6.1 release candidate 1?
 Core and Builtins
 -----------------
 
+- bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX. 
+  Patch by Matthieu Dartiailh.
+
 - bpo-29602: Fix incorrect handling of signed zeros in complex constructor for
   complex subclasses and for inputs having a __complex__ method. Patch
   by Serhiy Storchaka.
index 0e1607585245b9e52283f964bd24a2f1223322bd..6255ec7d47f5a20b8c39b2f92932a37f89dbac46 100644 (file)
@@ -1043,7 +1043,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
         case CALL_FUNCTION_KW:
             return -oparg-1;
         case CALL_FUNCTION_EX:
-            return - ((oparg & 0x01) != 0) - ((oparg & 0x02) != 0);
+            return -1 - ((oparg & 0x01) != 0);
         case MAKE_FUNCTION:
             return -1 - ((oparg & 0x01) != 0) - ((oparg & 0x02) != 0) -
                 ((oparg & 0x04) != 0) - ((oparg & 0x08) != 0);