[issue27140] Opcode for creating dict with constant keys

Serhiy Storchaka report at bugs.python.org
Fri Jun 10 03:48:39 EDT 2016


Serhiy Storchaka added the comment:

I have just tested. BUILD_CONST_KEY_MAP doesn't used in it, because at this time -0. still is not a constant, but an expression (negation of 0.). With -0 it doesn't work too.

$ ./python -m dis
{0: 1, 2: 3}
  1           0 LOAD_CONST               0 (1)
              2 LOAD_CONST               1 (3)
              4 LOAD_CONST               2 ((0, 2))
              6 BUILD_CONST_KEY_MAP      2
              8 POP_TOP
             10 LOAD_CONST               3 (None)
             12 RETURN_VALUE
$ ./python -m dis
{-0: 1, 2: 3}    
  1           0 LOAD_CONST               5 (0)
              2 LOAD_CONST               1 (1)
              4 LOAD_CONST               2 (2)
              6 LOAD_CONST               3 (3)
              8 BUILD_MAP                2
             10 POP_TOP
             12 LOAD_CONST               4 (None)
             14 RETURN_VALUE

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27140>
_______________________________________


More information about the Python-bugs-list mailing list