Message258979
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;
^ |
|
Date |
User |
Action |
Args |
2016-01-26 22:09:08 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka, yselivanov |
2016-01-26 22:09:08 | vstinner | set | messageid: <1453846148.27.0.154927762061.issue26204@psf.upfronthosting.co.za> |
2016-01-26 22:09:08 | vstinner | link | issue26204 messages |
2016-01-26 22:09:08 | vstinner | create | |
|