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

python crash after API misuse

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Shiboken
    • Labels:
      None
    • Platform/s:
      All
    • Commits:
      0a47111b454b8e1582d8595cadc348b61989ff29 (pyside/pyside-setup/dev) 8bf8b4bd5a760c2089faeac00491dddcda2681ab (pyside/pyside-setup/6.0) f9025b3f1999c1191a094c1dfdd3e0d215d47610 (pyside/tqtc-pyside-setup/tqtc/lts-5.15)

      Description

      In a new module created using shiboken tools the generated code crashes when calling the function with an invalid signature,

      This is the function signature generated:

      PyQiTissue.Data.DataPipelineItemViewSettings.viewSettings(self,gate:PyQiTissue.Data.DataPipelineItems.AbstractGate)->std.optional[PyQiTissue.Data.DataPipelineItems.GateViewSettings]

      This std::optional causes the problem:

       

      tmp/embedded.f__6ji3c.zip/shibokensupport/signature/parser.py:199: RuntimeWarning: pyside_type_init:
      UNRECOGNIZED: 'std.optional'
      <renatu> OFFENDING LINE: '2:PyQiTissue.Data.DataPipelineItemViewSettings.viewSettings(self,gate:PyQiTissue.Data.DataPipelineItems.AbstractGate)->std.optional[PyQiTissue.Data.DataPipelineItems.GateViewSettings]' 
      

       

      this crash because in the signature.cpp line 341

          PyObject *dict = PyObject_CallObject(pyside_globals->pyside_type_init_func, arg_tup);
          if (dict == nullptr) {
              if (PyErr_Occurred()) // ************** THIS RETURN NOT NULL  
                  return nullptr;
              // No error: return an empty dict.
              if (empty_dict == nullptr)
                  empty_dict = PyDict_New();
              return empty_dict;
          }

       

      And because of PyErr was set we get this assert and the app crashes.

      Fatal Python error: seterror_argument did not receive a result

       

        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:
            renatofilho renato araujo oliveira filho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes