Skip to content

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-SpinnerFidget-Spinner commented Jan 23, 2022

@Fidget-Spinner
Copy link
MemberAuthor

I added CHECK_EVAL_BREAKER to all CALL_X opcodes, but I'm not sure how to do that for CALL_NO_KW_PY_SIMPLE (and the inline Python call path of CALL_NO_KW). @pablogsal and @markshannon can I please get your opinion on whether we need to check for signals for those?

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the "error" label ends with DISPATCH(). It doesn't call CHECK_EVAL_BREAKER() even if we are coming from a CALL target which can get a signal (or any other reason to break the ceval).

I'm not sure that I like the test decorator, it makes a test 16x slower :-(

@vstinner
Copy link
Member

Currently, the "error" label ends with DISPATCH(). It doesn't call CHECK_EVAL_BREAKER() even if we are coming from a CALL target which can get a signal (or any other reason to break the ceval).

In Python 3.10, the error label ends with "goto main_loop" which does check for the ceval breaker atomic variable, no?

@vstinner
Copy link
Member

I added CHECK_EVAL_BREAKER to all CALL_X opcodes, but I'm not sure how to do that for CALL_NO_KW_PY_SIMPLE (and the inline Python call path of CALL_NO_KW). @pablogsal and @markshannon can I please get your opinion on whether we need to check for signals for those?

CALL_NO_KW_PY_SIMPLE optimization goes to start_frame which ends with DISPATCH(): it seems like the CHECK_EVAL_BREAKER() check has been eaten by the optimization, between Python 3.10 and 3.11. Either start_frame or start_frame should call CHECK_EVAL_BREAKER().

@vstinner
Copy link
Member

The ceval.c change are enough for almost all TARGET, except CALL_NO_KW_PY_SIMPLE which miss CHECK_EVAL_BREAKER() somewhere, but it can be fixed in a separated PR (with a fix for "error" label ? ;-)) if you prefer.

Co-Authored-By: Victor Stinner <[email protected]>
@Fidget-Spinner
Copy link
MemberAuthor

The ceval.c change are enough for almost all TARGET, except CALL_NO_KW_PY_SIMPLE which miss CHECK_EVAL_BREAKER() somewhere, but it can be fixed in a separated PR (with a fix for "error" label ? ;-)) if you prefer.

Yeah I'd prefer another PR for that. I don't think those changes came with the CALL_X PR, maybe one of the refactoring/dispatch optimizing PRs.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Co-Authored-By: Mark Shannon <[email protected]>
@Fidget-Spinner
Copy link
MemberAuthor

Fidget-Spinner commented Jan 24, 2022

Strange, Ubuntu tests fail even on non-specialized code.

testInstallHandler (unittest.test.test_break.TestBreak) ... testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ... FAIL testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=True) ... FAIL ====================================================================== FAIL: testInstallHandler (unittest.test.test_break.TestBreak) (cpython_is_warmedup=False) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/support/__init__.py", line 2142, in wrapper f(self) ^^^^^^^ File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/test/test_break.py", line 33, in testInstallHandler self.assertNotEqual(signal.getsignal(signal.SIGINT), default_handler) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: <unittest.signals._InterruptHandler object at 0x7f7f10afb760> == <unittest.signals._InterruptHandler object at 0x7f7f10afb760> 

I'll look into it.


# Tests both adaptive and specialized opcodes for proper
# CHECK_EVAL_BREAKER(). See bpo-46465 for an example bug.
@repeat_cpython_adaptative
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've tested in https://bugs.python.org/issue46709 there several more test cases that require this decorator:

  • testInterruptCaught
  • testSecondInterrupt
  • testTwoResults

@Fidget-Spinner
Copy link
MemberAuthor

Sorry, can I trouble someone here to take over this PR please? I can't complete it right now.

@sobolevn
Copy link
Member

@Fidget-Spinner I will cover your back 😉

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@Fidget-Spinner@vstinner@sobolevn@markshannon@kumaraditya303@raghavthind2005@the-knights-who-say-ni@bedevere-bot