Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
45a30af1
Commit
45a30af1
authored
Jun 27, 2019
by
Brandt Bucher
Committed by
Benjamin Peterson
Jun 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. (GH-14414)
parent
97d15b1e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
0 deletions
+6
-0
Lib/test/test_posix.py
Lib/test/test_posix.py
+1
-0
Misc/NEWS.d/next/Library/2019-06-26-22-25-05.bpo-37420.CxFJ09.rst
...S.d/next/Library/2019-06-26-22-25-05.bpo-37420.CxFJ09.rst
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+3
-0
No files found.
Lib/test/test_posix.py
View file @
45a30af1
...
...
@@ -1368,6 +1368,7 @@ class PosixTester(unittest.TestCase):
self
.
assertEqual
(
posix
.
sched_getaffinity
(
0
),
mask
)
self
.
assertRaises
(
OSError
,
posix
.
sched_setaffinity
,
0
,
[])
self
.
assertRaises
(
ValueError
,
posix
.
sched_setaffinity
,
0
,
[
-
10
])
self
.
assertRaises
(
ValueError
,
posix
.
sched_setaffinity
,
0
,
map
(
int
,
"0X"
))
self
.
assertRaises
(
OverflowError
,
posix
.
sched_setaffinity
,
0
,
[
1
<<
128
])
self
.
assertRaises
(
OSError
,
posix
.
sched_setaffinity
,
-
1
,
mask
)
...
...
Misc/NEWS.d/next/Library/2019-06-26-22-25-05.bpo-37420.CxFJ09.rst
0 → 100644
View file @
45a30af1
:func:`os.sched_setaffinity` now correctly handles errors that arise during iteration over its ``mask`` argument.
Patch by Brandt Bucher.
\ No newline at end of file
Modules/posixmodule.c
View file @
45a30af1
...
...
@@ -6413,6 +6413,9 @@ os_sched_setaffinity_impl(PyObject *module, pid_t pid, PyObject *mask)
}
CPU_SET_S
(
cpu
,
setsize
,
cpu_set
);
}
if
(
PyErr_Occurred
())
{
goto
error
;
}
Py_CLEAR
(
iterator
);
if
(
sched_setaffinity
(
pid
,
setsize
,
cpu_set
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment