From 60c66569b71df0a2a95f7ae15d459561f836d03d Mon Sep 17 00:00:00 2001 From: Kenta Murata <3959+mrkn@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:54:57 +0900 Subject: [PATCH] Explicitly describe about multi-threading We do not want to support multi-threading in PyCall. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e356a4d..15cd111 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ pycall.rb supports Ruby version 2.4 or higher. pycall.rb supports Python version 3.7 or higher. +## PyCall does not support multi-threaded use officially + +CPython's C-API has GIL acquiring/releasing functions such as `PyGILState_Ensure` and `PyGILState_Release`. Programmers can call CPython's C-APIs from outside of Python threads if they manage GIL's state by these functions. However, we do not want to officially support the multi-threaded use of PyCall because creating the feature enabling stable multi-threaded use in any situation is too difficult. We want to avoid incurring the costs to support such use cases. + ## Note for pyenv users pycall.rb requires Python's shared library (e.g. `libpython3.7m.so`).