]> granicus.if.org Git - python/commitdiff
compute stack effect of BUILD_MAP correctly (closes #25060)
authorBenjamin Peterson <benjamin@python.org>
Fri, 11 Sep 2015 04:02:39 +0000 (21:02 -0700)
committerBenjamin Peterson <benjamin@python.org>
Fri, 11 Sep 2015 04:02:39 +0000 (21:02 -0700)
Misc/NEWS
Python/compile.c
Python/importlib_external.h

index 2e709cbcdd15ba35f47a3776d296c7d5728b763f..7a48b062045bdf116c6733cedb0f4b8343d87866 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -14,6 +14,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode.
+
 - Issue #24857: Comparing call_args to a long sequence now correctly returns a
   boolean result instead of raising an exception.  Patch by A Kaptur.
 
index cfeab0fdfef37ea398c5dd44c05a2a60c254aee2..97bb12ee6719efd4f1d0a4abbe18d7f618acfc66 100644 (file)
@@ -985,7 +985,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
         case BUILD_MAP_UNPACK_WITH_CALL:
             return 1 - (oparg & 0xFF);
         case BUILD_MAP:
-            return 1;
+            return 1 - 2*oparg;
         case LOAD_ATTR:
             return 0;
         case COMPARE_OP:
index aea434c83ded027e351c6e5bb1cebc6f499c9cb2..48d6be58eee7bc48f31eaa0d1bf98c5d7e415e9d 100644 (file)
@@ -1395,7 +1395,7 @@ const unsigned char _Py_M__importlib_external[] = {
     32,83,111,117,114,99,101,76,111,97,100,101,114,32,117,115,
     105,110,103,32,116,104,101,32,102,105,108,101,32,115,121,115,
     116,101,109,46,99,2,0,0,0,0,0,0,0,3,0,0,
-    0,5,0,0,0,67,0,0,0,115,34,0,0,0,116,0,
+    0,4,0,0,0,67,0,0,0,115,34,0,0,0,116,0,
     0,124,1,0,131,1,0,125,2,0,100,1,0,124,2,0,
     106,1,0,100,2,0,124,2,0,106,2,0,105,2,0,83,
     41,3,122,33,82,101,116,117,114,110,32,116,104,101,32,109,