Commit cf2ad555 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling

function with generalized unpacking (PEP 448) and conflicting keyword names
could cause undefined behavior.
parents 52855452 3c317e76
......@@ -223,6 +223,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations)
# Python 3.5b2 3340 (fix dictionary display evaluation order #11205)
# Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400)
# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286)
# Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483
# Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed)
# Python 3.6a0 3370 (16 bit wordcode)
......
......@@ -57,6 +57,10 @@ Here we add keyword arguments
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'a'
>>> f(1, 2, a=3, **{'a': 4}, **{'a': 5})
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'a'
>>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7})
(1, 2, 3, 4, 5) {'a': 6, 'b': 7}
>>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9})
......
......@@ -248,6 +248,11 @@ Overridden parameters
...
TypeError: f() got multiple values for keyword argument 'x'
>>> f(x=5, **{'x': 3}, **{'x': 2})
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'x'
>>> f(**{1: 3}, **{1: 5})
Traceback (most recent call last):
...
......
......@@ -10,6 +10,10 @@ What's New in Python 3.6.0 alpha 2
Core and Builtins
-----------------
- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling
function with generalized unpacking (PEP 448) and conflicting keyword names
could cause undefined behavior.
- Issue #27140: Added BUILD_CONST_KEY_MAP opcode.
- Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519).
......
......@@ -1088,7 +1088,7 @@ static PYC_MAGIC magic_values[] = {
{ 3160, 3180, L"3.2" },
{ 3190, 3230, L"3.3" },
{ 3250, 3310, L"3.4" },
{ 3320, 3350, L"3.5" },
{ 3320, 3351, L"3.5" },
{ 3360, 3371, L"3.6" },
{ 0 }
};
......
......@@ -3487,7 +3487,7 @@ compiler_call_helper(struct compiler *c,
code |= 2;
if (nsubkwargs > 1) {
/* Pack it all up */
int function_pos = n + (code & 1) + nkw + 1;
int function_pos = n + (code & 1) + 2 * nkw + 1;
ADDOP_I(c, BUILD_MAP_UNPACK_WITH_CALL, nsubkwargs | (function_pos << 8));
}
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment