GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Multi-line arguments in a function call crashes CPython · Issue #101928 · python/cpython

Multi-line arguments in a function call crashes CPython #101928

New issue
Copy link
New issue
Copy link
Closed
Closed
Multi-line arguments in a function call crashes CPython#101928
Copy link
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@xiaxinmeng
xiaxinmeng
opened on Feb 15, 2023
Issue body actions

Crash report

In a function call, if one argument is split in two lines, CPython crashes. For example, we split the lambda expression, i.e., lamda_exp=lambda:1, in test2.py into two lines (See test1.py) . CPython reports a segmentation fault.

This crash just occurs on the latest main branch(e.g.commit a1f08f5, 8a2b7ee ). The older version of CPython(e.g. CPython 3.10.8, CPython 3.9.0 ) does not report any crash.

test1.py (Segmentation fault)

def foo(param, lambda_exp):
    pass

foo(param=0,
    lambda_exp=lambda:
    1)

test2.py (work well )

def foo(param, lambda_exp):
    pass

foo(param=0,
    lambda_exp=lambda:1)

Error messages

Segmentation Fault

Your environment

  • CPython versions tested on: main branch from GitHub (commit a1f08f5)
  • Operating system and architecture: Ubuntu 18.04

Linked PRs

  • gh-101928: fix crash in compiler on multi-line lambda in function call #101933

Activity

  1. xiaxinmeng
    added
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    on Feb 15, 2023
  2. xiaxinmeng
    changed the title [-]Multi-line arguments in function call crashes CPython[/-] [+]Multi-line arguments in a function call crashes CPython[/+] on Feb 15, 2023
  3. ronaldoussoren
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Feb 15, 2023
  4. hauntsaninja commented on Feb 15, 2023

    @hauntsaninja
    hauntsaninja
    on Feb 15, 2023
    Contributor
    More actions

    Thanks for the report! I bisected this to #101633 cc @penguin-wwy @iritkatriel

  5. kumaraditya303
    added
    3.12only security fixesonly security fixes
    release-blocker
    on Feb 15, 2023
  6. ezio-melotti
    added this to Release and Deferred blockers 🚫on Feb 15, 2023
  7. github-project-automation
    moved this to Todo in Release and Deferred blockers 🚫on Feb 15, 2023
  8. iritkatriel commented on Feb 15, 2023

    @iritkatriel
    iritkatriel
    on Feb 15, 2023
    Member
    More actions

    Thank you @hauntsaninja.

    I see the problem - we are now creating a basicblock with

    RETURN_CONST followed by NOP, and the redundant NOP is not being removed before propagate_line_numbers() uses BB_HAS_FALLTHROUGH on the block, which only looks at the last instruction to see if it exits the block.

    Possible fixes:

    1. (easiest) replace LOAD_CONST, RETURN_VALUE by NOP, RETURN_CONST (instead of RETURN_CONST, NOP).
    2. make sure the redundant NOP is removed before propagate_line_numbers is called

    I'll fix it tomorrow if nobody else will beat me to it.

    Reacted by penguin_wwy and Michael Droettboom
  9. penguin-wwy commented on Feb 15, 2023

    @penguin-wwy
    penguin-wwy
    on Feb 15, 2023
    Contributor
    More actions

    Thank you @hauntsaninja.

    I see the problem - we are now creating a basicblock with

    RETURN_CONST followed by NOP, and the redundant NOP is not being removed before propagate_line_numbers() uses BB_HAS_FALLTHROUGH on the block, which only looks at the last instruction to see if it exits the block.

    Possible fixes:

    1. (easiest) replace LOAD_CONST, RETURN_VALUE by NOP, RETURN_CONST (instead of RETURN_CONST, NOP).
    
    2. make sure the redundant NOP is removed before propagate_line_numbers is called
    

    I'll fix it tomorrow if nobody else will beat me to it.

    @iritkatriel Thanks for the fix suggestion, I tried to fix it using the first method and it seems to have minimal impact and is effective.

    Reacted by Michael Droettboom
  10. iritkatriel
    added a commit that references this issue on Feb 16, 2023

    gh-101928: fix crash in compiler on multi-line lambda in function call (

    df7ccf6
  11. iritkatriel commented on Feb 16, 2023

    @iritkatriel
    iritkatriel
    on Feb 16, 2023
    Member
    More actions

    Thanks for the report @xiaxinmeng, and for the fix @penguin-wwy .

  12. iritkatriel
    closed this as completedon Feb 16, 2023
  13. github-project-automation
    moved this from Todo to Done in Release and Deferred blockers 🚫on Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

    Projects

    • Release and Deferred blockers 🚫
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.