Repository navigation
Use uuid.uuid4() as the key in serialization. #7893
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
Changes from 2 commits
4b9ca42
63773de
d114552
f076fb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| import copy | ||
| import os | ||
| import signal | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| import threading | ||
| import warnings | ||
| import numpy as np | ||
|
|
||
|
|
@@ -13,7 +19,8 @@ | |
| from numba import njit, typeof, objmode, types | ||
| from numba.core.extending import overload | ||
| from numba.tests.support import (MemoryLeak, TestCase, captured_stdout, | ||
| skip_unless_scipy) | ||
| skip_unless_scipy, needs_strace, linux_only, | ||
| strace) | ||
| from numba.core.utils import PYVERSION | ||
| from numba.experimental import jitclass | ||
| import unittest | ||
|
|
@@ -1213,5 +1220,30 @@ def foo(): | |
| self.assertIn(msg, excstr) | ||
|
|
||
|
|
||
| class TestMisc(TestCase): | ||
| # Tests for miscellaneous objmode issues. Run serially. | ||
|
|
||
| _numba_parallel_test_ = False | ||
|
|
||
| @linux_only | ||
| @needs_strace | ||
| def test_no_fork_in_compilation(self): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self. This test probably needs to be run as a subprocess test on the basis that previous execution of something which triggers a stateful call e.g.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in d114552 |
||
| # Checks that there is no fork/clone/execve during compilation, see | ||
| # issue #7881. | ||
|
|
||
| def force_compile(): | ||
| @njit('void()') # force compilation | ||
| def f(): | ||
| with numba.objmode(): | ||
| pass | ||
|
|
||
| # capture these syscalls: | ||
| syscalls = ['fork', 'clone', 'execve'] | ||
|
|
||
| # check that compilation does not trigger fork, clone or execve | ||
| strace_data = strace(force_compile, syscalls) | ||
| self.assertFalse(strace_data) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: cloudpickle uses uuid4 for tracking unique classes. If it's safe for cloudpickle, it is safe for Numba