Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settrace skips lines when chaining methods without arguments #83497

Closed
alexmojaki mannequin opened this issue Jan 12, 2020 · 3 comments
Closed

settrace skips lines when chaining methods without arguments #83497

alexmojaki mannequin opened this issue Jan 12, 2020 · 3 comments
Labels
3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@alexmojaki
Copy link
Mannequin

alexmojaki mannequin commented Jan 12, 2020

BPO 39316
Nosy @markshannon, @alexmojaki
PRs
  • bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP 626. #24859
  • Files
  • trace_skipping_lines_bug.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-01-14.14:36:37.372>
    created_at = <Date 2020-01-12.21:13:44.795>
    labels = ['interpreter-core', 'type-bug', '3.9', '3.10']
    title = 'settrace skips lines when chaining methods without arguments'
    updated_at = <Date 2022-01-14.14:36:37.371>
    user = 'https://github.com/alexmojaki'

    bugs.python.org fields:

    activity = <Date 2022-01-14.14:36:37.371>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-14.14:36:37.372>
    closer = 'iritkatriel'
    components = ['Interpreter Core']
    creation = <Date 2020-01-12.21:13:44.795>
    creator = 'alexmojaki'
    dependencies = []
    files = ['48837']
    hgrepos = []
    issue_num = 39316
    keywords = ['patch']
    message_count = 3.0
    messages = ['359878', '388666', '388679']
    nosy_count = 2.0
    nosy_names = ['Mark.Shannon', 'alexmojaki']
    pr_nums = ['24859']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39316'
    versions = ['Python 3.9', 'Python 3.10']

    @alexmojaki
    Copy link
    Mannequin Author

    alexmojaki mannequin commented Jan 12, 2020

    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.

    @alexmojaki alexmojaki mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jan 12, 2020
    @alexmojaki
    Copy link
    Mannequin Author

    alexmojaki mannequin commented Mar 14, 2021

    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.
    >>> 
    

    @alexmojaki alexmojaki mannequin added 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Mar 14, 2021
    @markshannon
    Copy link
    Member

    New changeset d48848c by Mark Shannon in branch 'master':
    bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP-626. (GH-24859)
    d48848c

    @iritkatriel iritkatriel removed 3.7 (EOL) end of life 3.8 only security fixes labels Jan 14, 2022
    @iritkatriel iritkatriel removed 3.7 (EOL) end of life 3.8 only security fixes labels Jan 14, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants