pawelsalawa / sqlitestudio

A free, open source, multi-platform SQLite database manager.
https://sqlitestudio.pl
Other
4.92k stars 574 forks source link

ScriptingPython: fix locking on the first call with Python 3.12+ #5047

Closed tuffnatty closed 3 months ago

tuffnatty commented 3 months ago

The plugin was working well with Python 3.9 to 3.11. But when linked with Python 3.12+, the first Python function call locked forever. This patch adds required GIL decorations and comments about the Python thread and GIL state, fixing Python 3.12 and 3.13rc1.

pawelsalawa commented 3 months ago

Won't this break compatibility with prior python versions? I'm not sure if the compatibility should be maintained with older versions, but I think if we breake it, there will be questions from users. If this breaks compatibility, then maybe we should employ some #ifdefs?

tuffnatty commented 3 months ago

It does not break compatibility. It just does the required ritual, which was not so important before Python 3.12.