You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multi-line arguments in a function call crashes CPython #101928
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.
changed the title [-]Multi-line arguments in function call crashes CPython[/-][+]Multi-line arguments in a function call crashes CPython[/+]on Feb 15, 2023
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:
(easiest) replace LOAD_CONST, RETURN_VALUE by NOP, RETURN_CONST (instead of RETURN_CONST, NOP).
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.
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.
Activity
[-]Multi-line arguments in function call crashes CPython[/-][+]Multi-line arguments in a function call crashes CPython[/+]hauntsaninja commentedon Feb 15, 2023
Thanks for the report! I bisected this to #101633 cc @penguin-wwy @iritkatriel
iritkatriel commentedon Feb 15, 2023
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:
I'll fix it tomorrow if nobody else will beat me to it.
penguin-wwy commentedon Feb 15, 2023
@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.
gh-101928: fix crash in compiler on multi-line lambda in function call (
iritkatriel commentedon Feb 16, 2023
Thanks for the report @xiaxinmeng, and for the fix @penguin-wwy .