From 1421a06c50c16287efcc0ff9c42c489fa0a71060 Mon Sep 17 00:00:00 2001 From: Brian Dellabetta Date: Wed, 28 Jun 2023 15:18:24 -0500 Subject: [PATCH 1/3] allow user to configure opt_handle_signals --- pysrc/juliacall/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysrc/juliacall/__init__.py b/pysrc/juliacall/__init__.py index 70265ce4..fc290244 100644 --- a/pysrc/juliacall/__init__.py +++ b/pysrc/juliacall/__init__.py @@ -129,7 +129,7 @@ def args_from_config(): CONFIG['opt_sysimage'] = sysimg = path_option('sysimage', check_exists=True)[0] CONFIG['opt_threads'] = int_option('threads', accept_auto=True)[0] CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0] - CONFIG['opt_handle_signals'] = 'no' + CONFIG["opt_handle_signals"] = choice('handle_signals', ['yes', 'no'], default='no')[0] # Stop if we already initialised if CONFIG['inited']: From e9b7d181ce6835f2de8a5de205e36d32c705a291 Mon Sep 17 00:00:00 2001 From: Brian Dellabetta Date: Thu, 6 Jul 2023 09:10:13 -0600 Subject: [PATCH 2/3] update FAQ --- docs/src/faq.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/faq.md b/docs/src/faq.md index 2a661379..af219017 100644 --- a/docs/src/faq.md +++ b/docs/src/faq.md @@ -9,6 +9,11 @@ Some rules if you are writing multithreaded code: - You probably also need to call `PythonCall.GC.disable()` on the main thread before any threaded block of code. Remember to call `PythonCall.GC.enable()` again afterwards. (This is because Julia finalizers can be called from any thread.) +- Julia intentionally causes segmentation faults as part of the GC safepoint mechanism. + If unhandled, these segfaults will result in termination of the process. To enable signal handling, + set `PYTHON_JULIACALL_HANDLE_SIGNALS=yes` before any calls to import juliacall. This is equivalent + to starting julia with `julia --handle-signals=yes`, the default behavior in Julia. + See discussion [here](https://github.com/cjdoris/PythonCall.jl/issues/219#issuecomment-1605087024) for more information. - You may still encounter problems. Related issues: [#201](https://github.com/cjdoris/PythonCall.jl/issues/201), [#202](https://github.com/cjdoris/PythonCall.jl/issues/202) From ebf89190cb1e27d1dbd16fd6a196c4cd60e59fb7 Mon Sep 17 00:00:00 2001 From: Brian Dellabetta Date: Thu, 6 Jul 2023 09:38:24 -0600 Subject: [PATCH 3/3] revert to single-quote syntax --- pysrc/juliacall/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysrc/juliacall/__init__.py b/pysrc/juliacall/__init__.py index fc290244..03b30d4b 100644 --- a/pysrc/juliacall/__init__.py +++ b/pysrc/juliacall/__init__.py @@ -129,7 +129,7 @@ def args_from_config(): CONFIG['opt_sysimage'] = sysimg = path_option('sysimage', check_exists=True)[0] CONFIG['opt_threads'] = int_option('threads', accept_auto=True)[0] CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0] - CONFIG["opt_handle_signals"] = choice('handle_signals', ['yes', 'no'], default='no')[0] + CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'], default='no')[0] # Stop if we already initialised if CONFIG['inited']: