[issue42696] Duplicated unused bytecodes at end of function

2020-12-22 Thread Mark Shannon
Mark Shannon added the comment: In what way is it "kludgy"? There is a mathematical theorem that states that generated code will be imperfect, so we will have to live with that :) https://en.wikipedia.org/wiki/Full_employment_theorem 3.10a produces more efficient bytecode than 3.9. 3.9:

[issue42696] Duplicated unused bytecodes at end of function

2020-12-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Is this a problem in practice? It's just a hint that code generation has imperfections. >From a teacher's or author's point of view, it is something we have to explain >away when demonstrating dis(). It leaves the impression that Python is kludgy. ---

[issue42696] Duplicated unused bytecodes at end of function

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: This isn't a problem for me. I noticed it and figured I'd mention it. -- ___ Python tracker ___

[issue42696] Duplicated unused bytecodes at end of function

2020-12-21 Thread Mark Shannon
Mark Shannon added the comment: Our reachability analysis is correct (in this case at least). There is no unreachable code here. In theory we could merge the two basic blocks at the end, but searching for identical blocks and merging them is potentially quite expensive (and fiddly). What mig

[issue42696] Duplicated unused bytecodes at end of function

2020-12-21 Thread Mark Shannon
Mark Shannon added the comment: My guess is that we are changing the CFG after computing reachability leaving unreachable blocks marked as reachable. -- assignee: -> Mark.Shannon ___ Python tracker ___

[issue42696] Duplicated unused bytecodes at end of function

2020-12-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue42696] Duplicated unused bytecodes at end of function

2020-12-20 Thread Ned Batchelder
New submission from Ned Batchelder : (Using CPython commit c95f8bc270.) This program has extra bytecodes: def f(): for i in range(10): break return 17 The dis output is: 1 0 LOAD_CONST 0 () 2 LOAD_CONST