Skip to content

Commit bf478d6

Browse files
committed
BE-3131 Fix regression in test_signal
Fix for code removed by e361063. An update was also made to the if statement. Failing test: ====================================================================== FAIL: test_invalid_fd (__main__.WakeupFDTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/as-build/.cache/activestate/46e56921/usr/lib/python2.7/test/test_signal.py", line 239, in test_invalid_fd self.assertRaises(ValueError, signal.set_wakeup_fd, fd) AssertionError: ValueError not raised
1 parent c6b191e commit bf478d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Modules/signalmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,12 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
417417
return NULL;
418418
}
419419
#endif
420+
421+
if (fd != -1 && fstat(fd, &buf) != 0) {
422+
PyErr_SetString(PyExc_ValueError, "invalid fd");
423+
return NULL;
424+
}
425+
420426
old_fd = wakeup_fd;
421427
wakeup_fd = fd;
422428
return PyLong_FromLong(old_fd);

0 commit comments

Comments
 (0)