[issue34888] Python3.8 optimizes away a "while" line

2022-01-28 Thread Irit Katriel
Irit Katriel added the comment: Does PEP626 help with this problem? -- nosy: +iritkatriel ___ Python tracker ___ ___

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: > I assume there is some place that notices that the while condition is a > constant, and therefore doesn't need to be explicitly evaluated? To answer your question: yes, and it's unrelated to both peephole optimizer and to the above mentioned grand

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: > I assume there is some place that notices that the while condition is a > constant, and therefore doesn't need to be explicitly evaluated? Ah, I see what you're asking about. I'll need to double check that. --

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: It's more complicated than that: there's no more SETUP_LOOP opcode anymore. The ceval and compiler parts responsible for evaluating and compiling loops were rewritten. FWIW the goal was more about simplifying the needlessly complicated implementation and

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Ned Batchelder
Ned Batchelder added the comment: Yury, thanks. I haven't read the code in depth. I assume there is some place that notices that the while condition is a constant, and therefore doesn't need to be explicitly evaluated? That test can be disabled, yes? --

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: While I agree with you that we need a flag to disable optimizations, this particular change isn't related to AST or peephole optimizers. See the bpo-17611 for more details (or

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: +benjamin.peterson, vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue34888] Python3.8 optimizes away a "while" line

2018-10-03 Thread Ned Batchelder
New submission from Ned Batchelder : Looks like the optimizer is getting more aggressive. Line 2 (the constant while) no longer even appears in the bytecode: $ cat -n whiletrue.py 1 a = 1 2 while 1: 3 print(a) 4 b = 4 $ python3.7 -m dis < whiletrue.py 1