◐ Shell
clean mode source ↗

Test atexit shutdown mechanism in a subprocess by pitrou · Pull Request #4828 · python/cpython

@pitrou

vstinner

/* For the atexit module. */
void _Py_PyAtExit(void (*func)(void))
{
/* Guard against API misuse */

Choose a reason for hiding this comment

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

Maybe add "bpo-17852: " prefix. Otherwise, the purpose of the assertion is not obvious.

Or explain that calling this function to register a new callback replaces the previous callback, which is unlikely to be the expected behaviour.

Choose a reason for hiding this comment

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

Yes, adding a bpo references sounds good to me.

vstinner

Choose a reason for hiding this comment

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

test_atexit test LGTM, I just have a question/comment on the added assertion.

I merged your PR #4826, so you can rebase this one on top of it.

@vstinner

At least, the assertion worked as expected before you rebased this PR on top of PR #4826, Travis CI failed with:

python: Python/pylifecycle.c:2090: void _Py_PyAtExit(void (*)(void)): Assertion `_PyRuntime.pyexitfunc == ((void*)0) || _PyRuntime.pyexitfunc == func' failed.

vstinner

Choose a reason for hiding this comment

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

LGTM, thanks.

@miss-islington

Thanks @pitrou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@pitrou pitrou deleted the atexit_check_subprocess branch

December 13, 2017 01:29

@miss-islington

Sorry, @pitrou, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker fc5db95e0063eafa2bfb7f487fcaad5a7c4b65a1 3.6

pitrou added a commit to pitrou/cpython that referenced this pull request

Dec 13, 2017
* Test atexit shutdown mechanism in a subprocess.
(cherry picked from commit fc5db95)

@bedevere-bot

pitrou added a commit that referenced this pull request

Dec 13, 2017
* Test atexit shutdown mechanism in a subprocess.
(cherry picked from commit fc5db95)