[New-bugs-announce] [issue33318] Move folding tuples of constants into compiler.c from peephole.c

Serhiy Storchaka report at bugs.python.org
Fri Apr 20 08:57:21 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

Explicit tuples of constants are folded in the AST optimizer since 3.7. But peephole.c still contains the code for folding tuples of constants, because there are tuples created by the compiler. For example "[1, 2, *a]", "f(1, 2, *a)", "def f(a=1, b=2)" all create a tuple (1, 2).

The following PR moves this code from peephole.c into compiler.c. This makes the code a tiny bit clearer, because it works on higher level than  a bytecode. An obvious benefit -- the optimization is performed before calculating the depth of the stack, thus it will be more exact.

----------
components: Interpreter Core
messages: 315508
nosy: benjamin.peterson, brett.cannon, inada.naoki, ncoghlan, pitrou, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Move folding tuples of constants into compiler.c from peephole.c
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33318>
_______________________________________


More information about the New-bugs-announce mailing list