This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author takluyver
Recipients brett.cannon, bskinn, takluyver, xtreak
Date 2019-04-24.17:44:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556127864.75.0.226503385613.issue36695@roundup.psfhosted.org>
In-reply-to
Content
The 'single' option to compile() means it's run like at a REPL, calling displayhook if it's an expression returning a value.

But warnings shouldn't go through the displayhook, as far as I know:

>>> from contextlib import redirect_stdout, redirect_stderr
>>> from io import StringIO
>>> sio = StringIO()
>>> with redirect_stderr(sio):
...   exec(compile('import warnings; warnings.warn(""" \' " """)', 'dummyfile', 'single'))
... 
>>> print(sio.getvalue())
__main__:1: UserWarning:  ' "
History
Date User Action Args
2019-04-24 17:44:24takluyversetrecipients: + takluyver, brett.cannon, bskinn, xtreak
2019-04-24 17:44:24takluyversetmessageid: <1556127864.75.0.226503385613.issue36695@roundup.psfhosted.org>
2019-04-24 17:44:24takluyverlinkissue36695 messages
2019-04-24 17:44:24takluyvercreate