Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-37420: os.sched_setaffinity does not handle errors during iteration. #14414

Merged
merged 6 commits into from
Jun 27, 2019

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Jun 26, 2019

This is related to bpo-37417: os.sched_setaffinity doesn't properly handle errors that arise during iteration of the mask argument:

Python 3.9.0a0 (heads/master:d52a83a, Jun 26 2019, 15:13:41) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> bad_iter = map(int, "0X")
>>> os.sched_setaffinity(0, bad_iter)
ValueError: invalid literal for int() with base 10: 'X'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: <built-in function sched_setaffinity> returned a result with an error set

It looks like this bug is also present on all versions of Python 3. I've attached a patch with a fix and a regression test.

https://bugs.python.org/issue37420

Copy link
Contributor

@mangrisano mangrisano left a comment

Choose a reason for hiding this comment

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

LGTM.

@miss-islington
Copy link
Contributor

Thanks @brandtbucher for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

I'm having trouble backporting to 3.8. Reason: 'Error 110 while writing to socket. Connection timed out.'. Please retry by removing and re-adding the needs backport to 3.8 label.

@bedevere-bot
Copy link

GH-14425 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 27, 2019
…ity. (pythonGH-14414)

(cherry picked from commit 45a30af)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
@miss-islington
Copy link
Contributor

Thanks @brandtbucher for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-14426 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 27, 2019
…ity. (pythonGH-14414)

(cherry picked from commit 45a30af)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
miss-islington added a commit that referenced this pull request Jun 27, 2019
…ity. (GH-14414)

(cherry picked from commit 45a30af)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
@brandtbucher brandtbucher deleted the os-sched-setaffinity branch June 27, 2019 16:32
miss-islington added a commit that referenced this pull request Jun 27, 2019
…ity. (GH-14414)

(cherry picked from commit 45a30af)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
@brandtbucher brandtbucher restored the os-sched-setaffinity branch September 27, 2019 06:02
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants