#1379 SwigPyObject_append don't work for >2 elements

open
nobody
python (259)
5
2014-08-12
2014-08-11
jicks
No

When doing some multiple inheritance with Python classes generated by SWIG, a bug occurs when more than 2 classes are used: the underlying SWIG object (accessible through self.this) will only be able to track at most two classes, the first and last initialized.

I've tracked down the issue to the SwigPyObject_append method in the generated CPP code. This function doesn't check if the first argument (sobj) already has a next element.

Attachments:
+ swig.patch contains the patch we currently use to circumvent the issue;

1 Attachments

Discussion

  • William Fulton
    William Fulton
    2014-08-12

    Could you please put this patch on github https://github.com/swig/swig and include a runtime testcase.