Skip to content

Commit 5b90198

Browse files
allow user to configure opt_handle_signals (#333)
* allow user to configure opt_handle_signals * update FAQ * revert to single-quote syntax
1 parent e374e25 commit 5b90198

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/src/faq.md

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ Some rules if you are writing multithreaded code:
99
- You probably also need to call `PythonCall.GC.disable()` on the main thread before any
1010
threaded block of code. Remember to call `PythonCall.GC.enable()` again afterwards.
1111
(This is because Julia finalizers can be called from any thread.)
12+
- Julia intentionally causes segmentation faults as part of the GC safepoint mechanism.
13+
If unhandled, these segfaults will result in termination of the process. To enable signal handling,
14+
set `PYTHON_JULIACALL_HANDLE_SIGNALS=yes` before any calls to import juliacall. This is equivalent
15+
to starting julia with `julia --handle-signals=yes`, the default behavior in Julia.
16+
See discussion [here](https://github.com/cjdoris/PythonCall.jl/issues/219#issuecomment-1605087024) for more information.
1217
- You may still encounter problems.
1318

1419
Related issues: [#201](https://github.com/cjdoris/PythonCall.jl/issues/201), [#202](https://github.com/cjdoris/PythonCall.jl/issues/202)

pysrc/juliacall/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def args_from_config():
129129
CONFIG['opt_sysimage'] = sysimg = path_option('sysimage', check_exists=True)[0]
130130
CONFIG['opt_threads'] = int_option('threads', accept_auto=True)[0]
131131
CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0]
132-
CONFIG['opt_handle_signals'] = 'no'
132+
CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'], default='no')[0]
133133

134134
# Stop if we already initialised
135135
if CONFIG['inited']:

0 commit comments

Comments
 (0)