[New-bugs-announce] [issue32372] Optimize out __debug__ at the AST level

Serhiy Storchaka report at bugs.python.org
Tue Dec 19 09:11:45 EST 2017


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

__debug__ is substituted by the constant value at the code generation stage (see issue27169). This prevents it from participating in constant folding at the AST level. The proposed patch moves this optimization to the AST level. This will lead to optimizing "if not __debug__" and will allow to add more optimizations at the AST level (like optimizing expressions "a if __debug__ else b" and "__debug__ and a").

----------
assignee: serhiy.storchaka
components: Interpreter Core
messages: 308643
nosy: inada.naoki, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize out __debug__ at the AST level
type: enhancement
versions: Python 3.7

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


More information about the New-bugs-announce mailing list