diff -r 4803a6d569f7 Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py Mon Apr 27 17:49:16 2015 +0300 +++ b/Lib/importlib/_bootstrap.py Tue Apr 28 09:55:28 2015 -0400 @@ -420,12 +420,13 @@ # Python 3.4a4 3300 (more changes to __qualname__ computation) # Python 3.4rc2 3310 (alter __qualname__ computation) # Python 3.5a0 3320 (matrix multiplication operator) +# Python 3.5a1 3330 (STORE_MAP argument order change) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually # due to the addition of new opcodes). -MAGIC_NUMBER = (3320).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3330).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff -r 4803a6d569f7 Lib/test/test_compile.py --- a/Lib/test/test_compile.py Mon Apr 27 17:49:16 2015 +0300 +++ b/Lib/test/test_compile.py Tue Apr 28 09:55:28 2015 -0400 @@ -460,6 +460,17 @@ ast.body = [_ast.BoolOp()] self.assertRaises(TypeError, compile, ast, '', 'exec') + def test_dict_compile_order(self): + i = 0 + + def f(): + nonlocal i + i += 1 + return i + + d = {f(): f(), f(): f()} + self.assertEqual(d, {1: 2, 3: 4}) + @support.cpython_only def test_same_filename_used(self): s = """def f(): pass\ndef g(): pass""" diff -r 4803a6d569f7 Python/ceval.c --- a/Python/ceval.c Mon Apr 27 17:49:16 2015 +0300 +++ b/Python/ceval.c Tue Apr 28 09:55:28 2015 -0400 @@ -2407,8 +2407,8 @@ } TARGET(STORE_MAP) { - PyObject *key = TOP(); - PyObject *value = SECOND(); + PyObject *value = TOP(); + PyObject *key = SECOND(); PyObject *map = THIRD(); int err; STACKADJ(-2); diff -r 4803a6d569f7 Python/compile.c --- a/Python/compile.c Mon Apr 27 17:49:16 2015 +0300 +++ b/Python/compile.c Tue Apr 28 09:55:28 2015 -0400 @@ -3434,9 +3434,9 @@ ADDOP_I(c, BUILD_MAP, (n>0xFFFF ? 0xFFFF : n)); for (i = 0; i < n; i++) { VISIT(c, expr, + (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); + VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); - VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); ADDOP(c, STORE_MAP); } break;