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 vstinner
Recipients python-dev, rhettinger, serhiy.storchaka, vstinner, yselivanov
Date 2016-02-08.17:23:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
changeset:   100192:4bdb21380743
tag:         tip
user:        Victor Stinner <>
date:        Mon Feb 08 18:17:58 2016 +0100
files:       Lib/test/ Lib/test/ Lib/test/ Misc/NEWS Python/compile.c
compiler now ignores constant statements

The compile ignores constant statements and emit a SyntaxWarning warning.

Don't emit the warning for string statement because triple quoted string is a
common syntax for multiline comments.

Don't emit the warning on ellipis neither: 'def f(): ...' is a legit syntax for
abstract functions.


* test_ast: ignore SyntaxWarning when compiling test statements. Modify
  test_load_const() to use assignment expressions rather than constant
* test_code: add more kinds of constant statements, ignore SyntaxWarning when
  testing that the compiler removes constant statements.
* test_grammar: ignore SyntaxWarning on the statement "1"
Date User Action Args
2016-02-08 17:23:07vstinnersetrecipients: + vstinner, rhettinger, python-dev, serhiy.storchaka, yselivanov
2016-02-08 17:23:07vstinnersetmessageid: <>
2016-02-08 17:23:07vstinnerlinkissue26204 messages
2016-02-08 17:23:06vstinnercreate