Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-149879: Fix test_signal on Cygwin
* Check for SIG_BLOCK instead of pthread_sigmask() to decide if
  SIG_BLOCK, SIG_UNBLOCK and SIG_SETMASK constants should be
  converted to enums.
* Skip ITIMER_VIRTUAL and ITIMER_PROF tests on Cygwin: setitimer()
  fails with ItimerError(EINVAL).
  • Loading branch information
vstinner committed May 15, 2026
commit b7efd4b7f1262fdb0db694b0f744e7065336af2b
2 changes: 1 addition & 1 deletion Lib/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'Handlers', __name__,
lambda name: name in ('SIG_DFL', 'SIG_IGN'))

if 'pthread_sigmask' in _globals:
if 'SIG_BLOCK' in _globals:
_IntEnum._convert_(
'Sigmasks', __name__,
lambda name: name in ('SIG_BLOCK', 'SIG_UNBLOCK', 'SIG_SETMASK'))
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ def test_itimer_real(self):
# Issue 3864, unknown if this affects earlier versions of freebsd also
@unittest.skipIf(sys.platform in ('netbsd5',) or is_apple_mobile,
'itimer not reliable (does not mix well with threading) on some BSDs.')
@unittest.skipIf(sys.platform == 'cygwin',
"Cygwin doesn't support ITIMER_VIRTUAL")
def test_itimer_virtual(self):
self.itimer = signal.ITIMER_VIRTUAL
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
Expand All @@ -850,6 +852,8 @@ def test_itimer_virtual(self):
# and the handler should have been called
self.assertEqual(self.hndl_called, True)

@unittest.skipIf(sys.platform == 'cygwin',
"Cygwin doesn't support ITIMER_PROF")
def test_itimer_prof(self):
self.itimer = signal.ITIMER_PROF
signal.signal(signal.SIGPROF, self.sig_prof)
Expand Down
Loading