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 serhiy.storchaka, vstinner, yselivanov
Date 2016-01-26.22:09:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453846148.27.0.154927762061.issue26204@psf.upfronthosting.co.za>
In-reply-to
Content
Serhiy: "It looks to me that this optimization was added to avoid spending executing time for docstrings. Other cases almost never occur in real code and are not worth to be optimized. But the patch makes the code cleaner (it would even more cleaner if collapse all kinds of constants in Constant)."

Oh, I don't really care of performance. The bytecode just doesn't make any sense to me. I don't understand why we load a constant.

Maybe the compiler should emit a warning to say that the code doesn't make sense at all and is ignored?

Example with GCC:

$ cat x.c 
int main()
{
    1;
}


$ gcc x.c -Wall -o x
x.c: In function 'main':
x.c:3:5: warning: statement with no effect [-Wunused-value]
     1;
     ^
History
Date User Action Args
2016-01-26 22:09:08vstinnersetrecipients: + vstinner, serhiy.storchaka, yselivanov
2016-01-26 22:09:08vstinnersetmessageid: <1453846148.27.0.154927762061.issue26204@psf.upfronthosting.co.za>
2016-01-26 22:09:08vstinnerlinkissue26204 messages
2016-01-26 22:09:08vstinnercreate