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: settrace skips lines when chaining methods without arguments
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, alexmojaki
Priority: normal Keywords: patch

Created on 2020-01-12 21:13 by alexmojaki, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
trace_skipping_lines_bug.py alexmojaki, 2020-01-12 21:13
Pull Requests
URL Status Linked Edit
PR 24859 merged Mark.Shannon, 2021-03-14 16:48
Messages (3)
msg359878 - (view) Author: Alex Hall (alexmojaki) Date: 2020-01-12 21:13
When stepping through a multiline expression like this:

```
print(slug
      .replace("_", " ")
      .title()
      .upper()
      .replace("a", "b")
      .lower()
      .replace("The ", "the "))
```

only these lines are hit by the tracer function:

15 print(slug
16       .replace("_", " ")
19       .replace("a", "b")
21       .replace("The ", "the "))

I'm guessing the problem is that there are no expressions on the other lines, as the attributes and calls all start with slug.
msg388666 - (view) Author: Alex Hall (alexmojaki) Date: 2021-03-14 10:04
I just came across https://www.python.org/dev/peps/pep-0626/, seems like this would need to be fixed to satisfy the PEP, but on the latest CPython it's not:

```
➜  ~ python3.10 ~/Downloads/trace_skipping_lines_bug.py
14 slug = "doing_the_thing"
15 print(slug
16       .replace("_", " ")
15 print(slug
19       .replace("a", "b")
15 print(slug
21       .replace("The ", "the "))
15 print(slug
doing the thing
➜  ~ python3.10 --version                              
Python 3.10.0a6+
➜  ~ python3.10          
Python 3.10.0a6+ (heads/master:cd8dcbc, Mar 14 2021, 11:58:23) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
```
msg388679 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-03-14 18:01
New changeset d48848c83e0f3e41b65c8f741f3fb6dbce5b9c29 by Mark Shannon in branch 'master':
bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP 626. (GH-24859)
https://github.com/python/cpython/commit/d48848c83e0f3e41b65c8f741f3fb6dbce5b9c29
History
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83497
2022-01-14 14:36:37iritkatrielsetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: - Python 3.7, Python 3.8
2021-03-14 18:01:47Mark.Shannonsetmessages: + msg388679
2021-03-14 16:48:19Mark.Shannonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23619
2021-03-14 10:04:57alexmojakisettype: behavior
messages: + msg388666
versions: + Python 3.10
2021-03-14 10:03:25alexmojakisetnosy: + Mark.Shannon
2020-01-18 12:51:05terry.reedysetversions: - Python 2.7, Python 3.5, Python 3.6
2020-01-12 21:13:44alexmojakicreate