Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Disable signal.alarm
  • Loading branch information
tiran committed Feb 5, 2022
commit 0f8a37ce2d5aacad6525406caac126e7d856e5dc
13 changes: 13 additions & 0 deletions Lib/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _default_chunk_size():
with open(__file__, "r", encoding="latin-1") as f:
return f._CHUNK_SIZE

requires_alarm = unittest.skipUnless(
hasattr(signal, "alarm"), "test requires signal.alarm()"
)


class MockRawIOWithoutRead:
"""A RawIO implementation without read(), so as to exercise the default
Expand Down Expand Up @@ -4435,12 +4439,15 @@ def _read():
if e.errno != errno.EBADF:
raise

@requires_alarm
def test_interrupted_write_unbuffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0)

@requires_alarm
def test_interrupted_write_buffered(self):
self.check_interrupted_write(b"xy", b"xy", mode="wb")

@requires_alarm
def test_interrupted_write_text(self):
self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")

Expand Down Expand Up @@ -4472,9 +4479,11 @@ def on_alarm(*args):
wio.close()
os.close(r)

@requires_alarm
def test_reentrant_write_buffered(self):
self.check_reentrant_write(b"xy", mode="wb")

@requires_alarm
def test_reentrant_write_text(self):
self.check_reentrant_write("xy", mode="w", encoding="ascii")

Expand Down Expand Up @@ -4502,10 +4511,12 @@ def alarm_handler(sig, frame):
os.close(w)
os.close(r)

@requires_alarm
def test_interrupted_read_retry_buffered(self):
self.check_interrupted_read_retry(lambda x: x.decode('latin1'),
mode="rb")

@requires_alarm
def test_interrupted_read_retry_text(self):
self.check_interrupted_read_retry(lambda x: x,
mode="r", encoding="latin1")
Expand Down Expand Up @@ -4578,9 +4589,11 @@ def alarm2(sig, frame):
if e.errno != errno.EBADF:
raise

@requires_alarm
def test_interrupted_write_retry_buffered(self):
self.check_interrupted_write_retry(b"x", mode="wb")

@requires_alarm
def test_interrupted_write_retry_text(self):
self.check_interrupted_write_retry("x", mode="w", encoding="latin1")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Fix wasm32-emscripten test failures and platform issues.
- Add workarounds for missing _multiprocessing and failing socket.accept()
- Enable bzip2 again
- Disable large file support
- Disable signal.alarm for now
3 changes: 3 additions & 0 deletions Tools/wasm/config.site-wasm32-emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ ac_cv_func_setgroups=no
ac_cv_func_setresuid=no
ac_cv_func_setresgid=no

# alarm signal is not delivered, may need a callback into the event loop?
ac_cv_func_alarm=no

# To use dlopen, you need to use Emscripten's linking support,
# see https://github.com/emscripten-core/emscripten/wiki/Linking)
ac_cv_func_dlopen=no