Uh oh!
There was an error while loading. Please reload this page.
bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp(). - #11608
Conversation
vstinner
left a comment
There was a problem hiding this comment.
Need a test. You can copy and adapt the test_subprocess test:
def test_start_new_session(self):
# For code coverage of calling setsid(). We don't care if we get an
# EPERM error from it depending on the test execution environment, that
# still indicates that it was called.
try:
output = subprocess.check_output(
[sys.executable, "-c",
"import os; print(os.getpgid(os.getpid()))"],
start_new_session=True)
except OSError as e:
if e.errno != errno.EPERM:
raise
else:
parent_pgid = os.getpgid(os.getpid())
child_pgid = int(output)
self.assertNotEqual(parent_pgid, child_pgid)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Jan 18, 2019
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
That's wrong: parse_posix_spawn_flags() is called from py_posix_spawnp(), so function_name should be "posix_spawnp" in that case. You have to add a parameter to parse_posix_spawn_flags().
nitpick: I suggest to rename the variable to "func_name".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nanjekyejoannah
commented
Feb 1, 2019
@vstinner I made some changes . PTAL. |
izbyshev
commented
Feb 1, 2019
@nanjekyejoannah@vstinner Um, some of my comments were marked as resolved without addressing them, in particular, about shadowing the standard function with |
vstinner
commented
Feb 1, 2019
Oh, I didn't notice that. According to the GitHub UI, I was the only one who "requested changes" (voted -1 on the PR). I proposed to @nanjekyejoannah to reuse test_start_new_session() from test_subprocess. The comment of this test mentions setsid(). The 'start_new_session' parameter of subprocess.Popen becomes the 'call_setsid' parameter of _posixsubprocess.fork_exec() which then calls setsid(). If os.getpgid() is not appropriate: test_subprocess should be fixed as well. |
bedevere-bot
commented
Feb 1, 2019
|
vstinner
commented
Feb 1, 2019
Thanks and congrats @nanjekyejoannah, I merged your PR! I saw that almost all my requests have been addressed exception of 'func_name': you added func_name but its value is hardcoded to "posix_spawnp". I started to write a fix, but then I saw other minor issues in error messages. So I wrote PR #11719 directly instead. I'm fine with working step by step, not having the perfect commit directly. Sadly, when I testing my "func_name" change, I noticed that "test_posix" fails locally. Oh. Why Travis CI didn't detect it? Oh. Now I recall that Travis CI lacks the required constant and so the test is skipped (NotImplementedError...). I wrote PR #11718 just to skip the test, to have more time to fix the test. This PR was awaiting for 2 weeks and got many reviews. I chose to merge it to make progress ;-) |
bedevere-bot
commented
Feb 1, 2019
|
izbyshev
commented
Feb 1, 2019
Ah, I see. I prefer to leave simple comments so that they are not mixed with reviews by core devs, but my approach backfired in this case.
While I think that technically the existing |
pablogsal
commented
Feb 1, 2019
@vstinner I opened https://bugs.python.org/issue35876 after seeing the buildbot failures to track the failing test fixes. |
I have added a new setsid parameter to os.posix_spawnp() and os.posix_spawn().
I have not yet added a test for this.
@vstinner we can discuss this once you think this patch is good enough.
https://bugs.python.org/issue35537