sip 6.8.0+: AttributeError: 'WrappedClass' object has no attribute 'original_typedef'

Scott Talbert swt at techie.net
Sat Dec 9 02:36:19 GMT 2023


On Fri, 8 Dec 2023, Phil Thompson wrote:

> On 08/12/2023 00:57, Scott Talbert wrote:
>> On Tue, 5 Dec 2023, Phil Thompson wrote:
>> 
>>>> Hi Phil,
>>>> 
>>>> Trying to build wxPython with sip 6.8.0+ (latest snapshot), I'm
>>>> running into this Traceback:
>>>> 
>>>> Generating the _propgrid bindings...
>>>> sip-build: An internal error occurred...
>>>> Traceback (most recent call last):
>>>>   File "/opt/hostedtoolcache/Python/3.12.0/x64/bin/sip-build", line 8,
>>>> in <module>
>>>>     sys.exit(main())
>>>>              ^^^^^^
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/tools/build.py",
>>>> line 37, in main
>>>>     handle_exception(e)
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/exceptions.py",
>>>> line 83, in handle_exception
>>>>     raise e
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/tools/build.py",
>>>> line 34, in main
>>>>     project.build()
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/project.py",
>>>> line 245, in build
>>>>     self.builder.build()
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/builder.py",
>>>> line 46, in build
>>>>     self._generate_bindings()
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/builder.py",
>>>> line 273, in _generate_bindings
>>>>     buildable = bindings.generate()
>>>>                 ^^^^^^^^^^^^^^^^^^^
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/bindings.py",
>>>> line 220, in generate
>>>>     output_code(spec, self, project, buildable)
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/generator/outputs/code.py",
>>>> line 60, in output_code
>>>>     _module_code(spec, bindings, project, py_debug, buildable)
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/generator/outputs/code.py",
>>>> line 512, in _module_code
>>>>     _virtual_handler(sf, spec, handler)
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/generator/outputs/code.py",
>>>> line 4530, in _virtual_handler
>>>>     sipres_value = _call_default_ctor(spec, ctor)
>>>>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/generator/outputs/code.py",
>>>> line 4254, in _call_default_ctor
>>>>     class_type = fmt_argument_as_cpp_type(spec, arg.definition)
>>>>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>   File
>>>> "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/sipbuild/generator/outputs/formatters/argument.py",
>>>> line 46, in fmt_argument_as_cpp_type
>>>>     original_typedef = arg.original_typedef
>>>>                        ^^^^^^^^^^^^^^^^^^^^
>>>> AttributeError: 'WrappedClass' object has no attribute 'original_typedef'
>>>> Command 'sip-build --no-compile' failed with exit code 1.
>>>> 
>>>> 
>>>> Let me know if you need more details.
>>>> 
>>>> Thanks,
>>>> Scott
>>> 
>>> The fix is probably to change 'arg.definition' to 'arg' in line 4254 of 
>>> code.py.
>>> 
>>> Given the nature of the changes in v6.8 there are likely to be other minor 
>>> regressions. I'll release v6.8.1 when you are happy with it.
>> 
>> Thanks Phil, that fixed that error.  Now, when compiling, I'm seeing
>> some broken code.  See the attached file on lines 203 and 214 where
>> the if statement is not closed after the sipParsePair.
>
> Fixed in the repo.

Next issue:

[786/940] Compiling sip/cap/sip_richtextwxTextAttrBorders.cpp
../../../../sip/cpp/sip_richtextwxRichTextProperties.cpp: In function 
‘PyObject* meth_wxRichTextProperties_SetProperty(PyObject*, PyObject*, 
PyObject*)’:
../../../../sip/cpp/sip_richtextwxRichTextProperties.cpp:738:21: error: 
invalid ‘const_cast’ from type ‘int’ to type ‘wchar_t*’
   738 |             sipFree(const_cast<wchar_t *>(1));
       |                     ^~~~~~~~~~~~~~~~~~~~~~~~

Waf: Leaving directory 
`/home/talbert/wxPython/doxygen/Phoenix.sip680/build/waf/3.12/gtk3'
Build failed
  -> task in '_richtext' failed with exit status 1 (run with -v to display 
more information)

The file is attached.  It looks like with sip 6.7, the inner argument was 
'value' not '1'.  Let me know if you need further details.

Thanks,
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sip_richtextwxRichTextProperties.cpp
Type: text/x-c++src
Size: 37760 bytes
Desc: 
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20231208/8b269974/attachment-0001.cpp>


More information about the PyQt mailing list