This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Error trace of else inside class
Type: Stage: resolved
Components: Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Mark.Shannon Nosy List: ChenXuan, Mark.Shannon
Priority: normal Keywords: patch

Created on 2021-01-13 12:57 by ChenXuan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
a1.py ChenXuan, 2021-01-13 12:57
Pull Requests
URL Status Linked Edit
PR 24222 merged Mark.Shannon, 2021-01-15 12:27
Messages (3)
msg385023 - (view) Author: ChenXuan (ChenXuan) Date: 2021-01-13 12:57
Hi, python3.10 seems to give wrong trace here:
class A:
   if 3 < 9:
      a = 1
   else:
      a = 2

result:
    2: class A:
    1:    if 3 < 9:
    1:       a = 1
          else:
    1:       a = 2
       

command: python3.10 -m trace --count -C . a1.py
environment: Linux 5.8.0-36-generic #40~20.04.1-Ubuntu SMP
version: python3.10.0a4
msg385024 - (view) Author: ChenXuan (ChenXuan) Date: 2021-01-13 13:23
another example:
if 1 < 10:
    b = 1
    if 0:
        a = 1
else:
    a = 1
output:
    1: if 1 < 10:
    1:     b = 1
    1:     if 0:
    1:         a = 1
       else:
           a = 1
Is this a bug or feature?
msg385072 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-01-14 18:09
It's a bug.
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87091
2021-01-21 11:29:19Mark.Shannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-01-15 12:27:36Mark.Shannonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23047
2021-01-14 18:09:29Mark.Shannonsetassignee: Mark.Shannon
messages: + msg385072
2021-01-13 21:01:04gvanrossumsetnosy: + Mark.Shannon
2021-01-13 13:23:05ChenXuansetmessages: + msg385024
2021-01-13 12:57:56ChenXuancreate