Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-931

Option to control GIL-code-handling in shiboken2

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.12.1
    • Fix Version/s: 5.12.2
    • Component/s: Shiboken
    • Labels:
      None
    • Environment:

       

    • Platform/s:
      All
    • Commits:
      099f3f46ca9ec1362f211278df4b3e4949b0a339 (pyside/pyside-setup/5.12)

      Description

      There should be an option to have shiboken2 not deal with the GIL in generated code per default. This could be enabled on the command line of shiboken2 or via the typesystem.xml. Scope should be global or at least per type (class).

      It's all about code generated like this (for most, if not all, methods): 

      PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS
      // ...my code here...
      PyEval_RestoreThread( _save ); // Py_END_ALLOW_THREADS
      

      I don't want shiboken2 to do those PyEval_SaveThread()- / PyEval_RestoreThread( _save )-calls. Reason: I don't want shiboken2 to make assumptions about the code the user may add there. In my case, for instance, I really need to hold the GIL there in many cases.

      I've read about the "modify-function" node along with "allow-thread" here: modify-function. This is nice but would require me to apply it to each and every method (I've really a lot of those )
       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              kleint Friedemann Kleint
              Reporter:
              thebrave71 David Venditti
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes