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
08e153ae
Commit
08e153ae
authored
Jan 18, 2013
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check windows fd validity (closes #16992)
parent
d0c665e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
Lib/test/test_signal.py
Lib/test/test_signal.py
+10
-2
Misc/NEWS
Misc/NEWS
+3
-0
Modules/signalmodule.c
Modules/signalmodule.c
+1
-1
No files found.
Lib/test/test_signal.py
View file @
08e153ae
...
...
@@ -227,6 +227,13 @@ class WindowsSignalTests(unittest.TestCase):
signal
.
signal
(
7
,
handler
)
class
WakeupFDTests
(
unittest
.
TestCase
):
def
test_invalid_fd
(
self
):
fd
=
support
.
make_bad_fd
()
self
.
assertRaises
(
ValueError
,
signal
.
set_wakeup_fd
,
fd
)
@
unittest
.
skipIf
(
sys
.
platform
==
"win32"
,
"Not valid on Windows"
)
class
WakeupSignalTests
(
unittest
.
TestCase
):
TIMEOUT_FULL
=
10
...
...
@@ -485,8 +492,9 @@ class ItimerTest(unittest.TestCase):
def
test_main
():
test_support
.
run_unittest
(
BasicSignalTests
,
InterProcessSignalTests
,
WakeupSignalTests
,
SiginterruptTest
,
ItimerTest
,
WindowsSignalTests
)
WakeupFDTests
,
WakeupSignalTests
,
SiginterruptTest
,
ItimerTest
,
WindowsSignalTests
)
if
__name__
==
"__main__"
:
...
...
Misc/NEWS
View file @
08e153ae
...
...
@@ -189,6 +189,9 @@ Core and Builtins
Library
-------
-
Issue
#
16992
:
On
Windows
in
signal
.
set_wakeup_fd
,
validate
the
file
descriptor
argument
.
-
Issue
#
15861
:
tkinter
now
correctly
works
with
lists
and
tuples
containing
strings
with
whitespaces
,
backslashes
or
unbalanced
braces
.
...
...
Modules/signalmodule.c
View file @
08e153ae
...
...
@@ -407,7 +407,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
return
NULL
;
}
#endif
if
(
fd
!=
-
1
&&
fstat
(
fd
,
&
buf
)
!=
0
)
{
if
(
fd
!=
-
1
&&
(
!
_PyVerify_fd
(
fd
)
||
fstat
(
fd
,
&
buf
)
!=
0
)
)
{
PyErr_SetString
(
PyExc_ValueError
,
"invalid fd"
);
return
NULL
;
}
...
...
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