mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
This prevents the Python GIL from being released before calling the method (which is the default behaviour). For very cheap to call c++ methods the cost of releasing the GIL can outweigh the cost of the c++ call, which means it's more efficient to retain the hold on the GIL. Ideally we'd do this everywhere, and switch to an explicit ReleaseGIL annotation on functions which are slow or risky (raise exceptions, or do something which can cause a GIL deadlock). But those are very tricky to identify, so instead just explicitly hold the gil on cheap methods which are likely to be called many times and could have an impact on script performance.