Skip to content

Commit b685515

Browse files
committed
compute stack effect of BUILD_MAP correctly (closes #25060)
1 parent 508a81e commit b685515

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Misc/NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Core and Builtins
1414
Library
1515
-------
1616

17+
- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode.
18+
1719
- Issue #24857: Comparing call_args to a long sequence now correctly returns a
1820
boolean result instead of raising an exception. Patch by A Kaptur.
1921

Python/compile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
985985
case BUILD_MAP_UNPACK_WITH_CALL:
986986
return 1 - (oparg & 0xFF);
987987
case BUILD_MAP:
988-
return 1;
988+
return 1 - 2*oparg;
989989
case LOAD_ATTR:
990990
return 0;
991991
case COMPARE_OP:

Python/importlib_external.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ const unsigned char _Py_M__importlib_external[] = {
13951395
32,83,111,117,114,99,101,76,111,97,100,101,114,32,117,115,
13961396
105,110,103,32,116,104,101,32,102,105,108,101,32,115,121,115,
13971397
116,101,109,46,99,2,0,0,0,0,0,0,0,3,0,0,
1398-
0,5,0,0,0,67,0,0,0,115,34,0,0,0,116,0,
1398+
0,4,0,0,0,67,0,0,0,115,34,0,0,0,116,0,
13991399
0,124,1,0,131,1,0,125,2,0,100,1,0,124,2,0,
14001400
106,1,0,100,2,0,124,2,0,106,2,0,105,2,0,83,
14011401
41,3,122,33,82,101,116,117,114,110,32,116,104,101,32,109,

0 commit comments

Comments
 (0)