Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST,BUG: Use fork context to fix MacOS savez test #22221

Merged
merged 1 commit into from Sep 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions numpy/lib/tests/test_io.py
Expand Up @@ -13,7 +13,7 @@
from io import BytesIO, StringIO
from datetime import datetime
import locale
from multiprocessing import Process, Value
from multiprocessing import Value, get_context
from ctypes import c_bool

import numpy as np
Expand Down Expand Up @@ -595,7 +595,12 @@ def check_large_zip(memoryerror_raised):
# Use an object in shared memory to re-raise the MemoryError exception
# in our process if needed, see gh-16889
memoryerror_raised = Value(c_bool)
p = Process(target=check_large_zip, args=(memoryerror_raised,))

# Since Python 3.8, the default start method for multiprocessing has
# been changed from 'fork' to 'spawn' on macOS, causing inconsistency
# on memory sharing model, lead to failed test for check_large_zip
ctx = get_context('fork')
p = ctx.Process(target=check_large_zip, args=(memoryerror_raised,))
p.start()
p.join()
if memoryerror_raised.value:
Expand Down