I've been looking at python/swift interop and from what I've been able to piece together from github, Python.import calls dlopen on the users path to python. Some questions I have are:
Does dlopen spin up an actual Python interpreter? I always assumed it just loads a library to call into.
Do multiple calls to Python.import spin up multiple interpreters or simple load a library?
How does this interface with concurrency in Swift? Will I be using separate interpreters per thread or a single global one? What are the implications here?
dlopen loads the Python runtime library of a particular version (selected via PythonLibrary.useVersion(_:_:)), without running an actual Python interpreter.
Was just reading through 8.1 Thread State and the Global Interpreter Lock
So if I'm interpreting this documentation correctly there is 1 interpreter and then a global lock that threads have to acquire when they want to run python.
without running an actual Python interpreter.
Does the interpreter then only run when dynamic calls are made to PythonObjects? Does every call to a PythonObject have to acquire the lock individually?