[issue44816] PEP 626 does not explain the handling of constants, at all.

2021-08-03 Thread Brandt Bucher


Brandt Bucher  added the comment:

Thanks for clarifying.

I'm worried, though, that the PEP's emphasis on "*all* lines of code executed 
and *only* for lines of code that are executed" could be problematic for other 
optimizations we perform. Consider:

if (  # <--
True  # <--
):
pass  # <--

I understand why lines 1 and 4 are covered, since PEP 626 defines "if" and 
"pass" keywords as executable code. But line 2 isn't executed at runtime (it's 
peepholed into a NOP)... is it a bug that it creates a line event?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44816] PEP 626 does not explain the handling of constants, at all.

2021-08-03 Thread Mark Shannon


Mark Shannon  added the comment:

This isn't a bug. Although PEP 626 is not at all clear about this.

The key word in the PEP is "executed".
Because compound and multi-line constants are constants, the parts of them are 
not "executed", but computed at compile time.

Having re-read the PEP, this is as clear as mud :(

I'll add a section to the PEP clarifying this.

--
assignee:  -> Mark.Shannon
title: Folded constants do not trace correctly. -> PEP 626 does not explain the 
handling of constants, at all.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com