Open dzejkob-b opened 5 months ago
Do you have an idea how to solve this problem properly?
Solving this properly would require that either PyInstaller can handle the bytecodes in the nogil
fork, or that the nogil fork is modified to use CPython 3.9 bytecodes. I don't think either of those things are likely to happen. I don't think that it's worth investing in either this point now that we are focused on CPython 3.13.
FWIW, the free-threaded (i.e, "nogil) build of 3.13 uses the same bytecodes as the default build, and so won't have this problem. (Assuming that PyInstaller can support CPython 3.13)
So if I understand correctly, the latest version of cpython 3.13 supports to natively turn off gil? I found this:
https://github.com/python/cpython/issues/108223
pyinstaller have some support: "PyInstaller will also not work with beta releases of Python 3.13.".
Can you please clarify if there are any significant differences between nogil in this fork and python 3.13 build with --disable-gil ? (except, of course, for differences between versions of Python)
So if I understand correctly, the latest version of cpython 3.13 supports to natively turn off gil?
We are working towards that, but it is not ready yet.
Can you please clarify if there are any significant differences between nogil in this fork and python 3.13 build with --disable-gil ?
They have the same goal (no GIL) but otherwise the implementations are pretty different. A lot of Python internals changed between Python 3.9 and Python 3.13. For example, the Python bytecodes, which look to be the source of the PyInstaller incompatibility are different in Python 3.9, Python 3.13, and this nogil fork. However, they should be the same between the --disable-gil
and default builds of CPython 3.13
Hello,
I have nogil-python compiled under Windows with an application built in Cython - and everything works fine. But there are problems when I tried to wrap the application using PyInstaller, the following error occurred:
it looks like a problem with nogil-python, because the package is completed fine under pyinstaller with standard cpython. But i tried to make these dumb fixes:
In nogil-python/Lib/site-packages/PyInstaller/depend/bytecode.py added this under imports:
dis.opmap['EXTENDED_ARG'] = 144
Than added bound check in this function:
Than updated this:
And in function:
def function_calls(code: CodeType) -> list:
added check:
and in file nogil-python/Lib/dis.py added bound check in this function:
after these fixes, PyInstaller starts and successfully packages the application into a working binary. However, it is worth mentioning that almost the entire application is written in Cython and everything is compiled in the Cython module. I'm not sure if these fixes will work in a pure Python application - apparently it omits some calls or arguments.
Do you have an idea how to solve this problem properly?