[New-bugs-announce] [issue30076] Opcode names BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL are too long

Serhiy Storchaka report at bugs.python.org
Sat Apr 15 13:27:19 EDT 2017


New submission from Serhiy Storchaka:

Two new opcodes BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL (added in 3.5 and 3.6) have too long names (26 and 28 characters). This exceeds the width of the opcode names in the dis module (20 characters). Increasing the width of the column will make opcode arguments too distant from opcode names, that will decrease readability. The better solution would be renaming these two opcodes.

They are used for merging iterables and mappings of positional and keyword arguments when used var-positional (*args) and var-keyword (**kwargs) arguments. Maybe new names should reflect this.

>>> dis.dis('f(a, b, *args, x=x, y=y, **kw)')
  1           0 LOAD_NAME                0 (f)
              2 LOAD_NAME                1 (a)
              4 LOAD_NAME                2 (b)
              6 BUILD_TUPLE              2
              8 LOAD_NAME                3 (args)
             10 BUILD_TUPLE_UNPACK_WITH_CALL     2
             12 LOAD_NAME                4 (x)
             14 LOAD_NAME                5 (y)
             16 LOAD_CONST               0 (('x', 'y'))
             18 BUILD_CONST_KEY_MAP      2
             20 LOAD_NAME                6 (kw)
             22 BUILD_MAP_UNPACK_WITH_CALL     2
             24 CALL_FUNCTION_EX         1
             26 RETURN_VALUE

----------
messages: 291725
nosy: ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Opcode names BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL are too long
type: enhancement
versions: Python 3.7

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


More information about the New-bugs-announce mailing list