Skip to content

[BUG] A simple C++ SWIG example fails when built through setuptools #5059

@yurivict

Description

@yurivict

setuptools version

63.1.0

Python version

Python3.11

OS

FreeBSD

Additional environment information

No response

Description

Testcase: swig-testcase-method-is-missing.shar

This testcase builds a python module that is missing the xadd function that is present in the C++ class.

How to run:
make && python my.py

This fails:

Traceback (most recent call last):
  File "/usr/home/yuri/python/minimal-swig-demo-testcase/my.py", line 10, in <module>
    print(f'xadd->{c.xadd(1,4)}')
                   ^^^^^^
AttributeError: 'SwigPyObject' object has no attribute 'xadd'
swig/python detected a memory leak of type 'cls *', no destructor found.

This simplified example below succeeds when it is compiled using pure swig and build commands.

Simplified testcase that succeeds: swig-testcase-method-is-missing-simplified.shar

Expected behavior

n/a

How to Reproduce

See above.

Output

See above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions