FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-37420: os.sched_setaffinity does not handle errors during iteration. by brandtbucher · Pull Request #14414 · python/cpython · GitHub

Repository navigation

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

Merged
benjaminp merged 6 commits into
python:masterfrom
brandtbucher:os-sched-setaffinity
Jun 27, 2019
Merged

benjaminp merged 6 commits into
python:masterfrom
brandtbucher:os-sched-setaffinity

Conversation

brandtbucher commented Jun 26, 2019 •
edited
Loading

Copy link
Copy Markdown
Member

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

Comment thread Lib/test/test_os.py Outdated
Comment thread Modules/posixmodule.c

mangrisano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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.

Copy link
Copy Markdown

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>

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL