[New-bugs-announce] [issue22091] __debug__ in compile(optimize=1)

Armin Rigo report at bugs.python.org
Sun Jul 27 13:32:00 CEST 2014

New submission from Armin Rigo:

The documentation of the built-in compile() function is not 100% clear but I think it says that giving the "optimize=1" argument turns "__debug__" to false in the compiled code ( https://docs.python.org/3.5/library/functions.html?highlight=compile#compile ).  It doesn't work this way in practice, though:

    >>> exec(compile("print(__debug__)", "exec", "exec", optimize=1))

I'd recommend to fix either the documentation or the source code.

messages: 224119
nosy: arigo
priority: normal
severity: normal
status: open
title: __debug__ in compile(optimize=1)

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list