Skip to content

Commit 1244c81

Browse files
authored
bpo-31904: Support signal module on VxWorks (GH-23391)
1 parent 5c73afc commit 1244c81

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Lib/test/test_signal.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,14 @@ def handler(signum, frame):
519519
else:
520520
write.setblocking(False)
521521
522-
# Start with large chunk size to reduce the
523-
# number of send needed to fill the buffer.
524522
written = 0
525-
for chunk_size in (2 ** 16, 2 ** 8, 1):
523+
if sys.platform == "vxworks":
524+
CHUNK_SIZES = (1,)
525+
else:
526+
# Start with large chunk size to reduce the
527+
# number of send needed to fill the buffer.
528+
CHUNK_SIZES = (2 ** 16, 2 ** 8, 1)
529+
for chunk_size in CHUNK_SIZES:
526530
chunk = b"x" * chunk_size
527531
try:
528532
while True:
@@ -595,6 +599,7 @@ def handler(signum, frame):
595599

596600

597601
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
602+
@unittest.skipUnless(hasattr(signal, 'siginterrupt'), "needs signal.siginterrupt()")
598603
class SiginterruptTest(unittest.TestCase):
599604

600605
def readpipe_interrupted(self, interrupt):
@@ -680,6 +685,8 @@ def test_siginterrupt_off(self):
680685

681686

682687
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
688+
@unittest.skipUnless(hasattr(signal, 'getitimer') and hasattr(signal, 'setitimer'),
689+
"needs signal.getitimer() and signal.setitimer()")
683690
class ItimerTest(unittest.TestCase):
684691
def setUp(self):
685692
self.hndl_called = False
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support signal module on VxWorks.

Modules/signalmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ static volatile struct {
120120
#else
121121
#define INVALID_FD (-1)
122122
static volatile struct {
123+
#ifdef __VXWORKS__
124+
int fd;
125+
#else
123126
sig_atomic_t fd;
127+
#endif
124128
int warn_on_full_buffer;
125129
} wakeup = {.fd = INVALID_FD, .warn_on_full_buffer = 1};
126130
#endif

0 commit comments

Comments
 (0)