Issue 32372: Optimize out debug at the AST level (original) (raw)

Issue32372

Created on 2017-12-19 14:11 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4925 merged serhiy.storchaka,2017-12-19 14:17
Messages (2)
msg308643 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-19 14:11
__debug__ is substituted by the constant value at the code generation stage (see ). 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").
msg309035 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-25 10:47
New changeset 3dfbaf51f0d90646e0414ddbd3b513ee8e5ffe9b by Serhiy Storchaka in branch 'master': bpo-32372: Move __debug__ optimization to the AST level. (#4925) https://github.com/python/cpython/commit/3dfbaf51f0d90646e0414ddbd3b513ee8e5ffe9b
History
Date User Action Args
2022-04-11 14:58:55 admin set github: 76553
2017-12-25 10:48:57 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2017-12-25 10:47:57 serhiy.storchaka set messages: +
2017-12-19 14:17:18 serhiy.storchaka set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest4819>
2017-12-19 14:11:45 serhiy.storchaka create