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

Global constant not managed correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5: Not important
    • 5.7
    • 1.2.0
    • Shiboken
    • None
    • shiboken 1.2.0, gcc 4.6.3, python 2.7.3

    Description

      If a constant is defined in header wrapped by shiboken, it results in a build error.

      Example :

      suppose global.h includes an header sample.h defined by : sample.h

      namespace sample {
        const double CONSTANT = 1.2345;
      }
      

      typesystem.xml

      <?xml version="1.0"?>
      <typesystem package="pysample">
        <primitive-type name="double"/>
        <namespace-type name="sample" generate="yes">
        </namespace-type>
      </typesystem>
      

      Shiboken generates :

      static PyObject* Sbk_sample_get_CONSTANT(PyObject* self, void*)
      {
          ::sample* cppSelf = 0;
          SBK_UNUSED(cppSelf)
          if (!Shiboken::Object::isValid(self))
              return 0;
          cppSelf = ;
          PyObject* pyOut =
      Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<double>(),
      &cppSelf->CONSTANT);
          return pyOut;
      }
      

      this code fails at build :

      sample_wrapper.cpp: In function ‘PyObject*
      Sbk_sample_get_CONSTANT(PyObject*, void*)’:
      sample_wrapper.cpp:609:13: erreur: expected primary-expression before ‘*’
      token
      sample_wrapper.cpp:609:15: erreur: ‘cppSelf’ was not declared in this scope
      sample_wrapper.cpp:613:15: erreur: expected primary-expression before ‘;’
      token
      make[2]: ***
      [pysample/CMakeFiles/pysample.dir/pysample/sample_wrapper.cpp.o] Erreur 1
      make[1]: *** [pysample/CMakeFiles/pysample.dir/all] Erreur 2
      make: *** [all] Erreur 2
      

      It seems that shiboken considers the constant as a function without name

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-186
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              guillaumeb Guilaume Baty
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes