classification
Title: Incorrect line number in bytecode for nested loops
Type: behavior Stage: needs patch
Components: Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Mark.Shannon Nosy List: Mark.Shannon, nedbat
Priority: normal Keywords: patch

Created on 2020-12-14 09:24 by Mark.Shannon, last changed 2020-12-14 13:06 by Mark.Shannon. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23761 merged Mark.Shannon, 2020-12-14 09:29
Messages (2)
msg382968 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2020-12-14 09:24
The following code, when traced, produces a spurious line events at the end of the inner loop.


def dloop():
    for i in range(3):
        for j in range(3):
            a = i + j
    assert a == 4



Bug reported by Ned Batchelder https://gist.github.com/nedbat/6c5dedde9df8d2de13de8a6a39a5f112
msg382980 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2020-12-14 11:28
New changeset f5e97b72fecff9b9ced35704ec5e6cad29e2825d by Mark Shannon in branch 'master':
bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761)
https://github.com/python/cpython/commit/f5e97b72fecff9b9ced35704ec5e6cad29e2825d
History
Date User Action Args
2020-12-14 13:06:10Mark.Shannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> needs patch
2020-12-14 11:28:54Mark.Shannonsetmessages: + msg382980
2020-12-14 09:29:40Mark.Shannonsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request22617
2020-12-14 09:24:33Mark.Shannoncreate