[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Ned Batchelder


Ned Batchelder  added the comment:

This fix looks good, thanks.

--

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 762ef85f441cdec002cb4e812b9e77ae5033e571 by Mark Shannon in 
branch '3.10':
bpo-44840: Compiler: Move duplication of exit blocks with no line numbers to 
after CFG optimization. (GH-27656) (#27673)
https://github.com/python/cpython/commit/762ef85f441cdec002cb4e812b9e77ae5033e571


--
nosy: +pablogsal

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26161
pull_request: https://github.com/python/cpython/pull/27673

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset b854557b49083d8625a433eb36aacb0c87d67c52 by Mark Shannon in 
branch 'main':
bpo-44840: Compiler: Move duplication of exit blocks with no line numbers to 
after CFG optimization. (GH-27656)
https://github.com/python/cpython/commit/b854557b49083d8625a433eb36aacb0c87d67c52


--

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-07 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
pull_requests: +26150
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27656

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Ned Batchelder


New submission from Ned Batchelder :

Note: this is very similar to https://bugs.python.org/issue42810
This was originally reported against coverage.py: 
https://github.com/nedbat/coveragepy/issues/1205

---8<-
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

print(sys.version)
sys.settrace(trace)

def func():
if A:
if B:
if C:
if D:
return False
else:
return False
elif E and F:
return True

A = B = True
C = False

func()
-

This produces this trace output:

3.10.0rc1 (default, Aug  3 2021, 15:03:55) [Clang 12.0.0 (clang-1200.0.32.29)]
call 13: def func():
line 14: if A:
line 15: if B:
line 16: if C:
line 21: elif E and F:
retu 21: elif E and F:

The elif on line 21 is not executed, and should not be traced.

Also, if I change line 21 to `elif E:`, then the trace changes to:

3.10.0rc1 (default, Aug  3 2021, 15:03:55) [Clang 12.0.0 (clang-1200.0.32.29)]
call 13: def func():
line 14: if A:
line 15: if B:
line 16: if C:
line 22: return True
retu 22: return True

--
components: Interpreter Core
keywords: 3.10regression
messages: 399003
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Nested if/else gets phantom else trace again (3.10)
type: behavior
versions: Python 3.10

___
Python tracker 

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