Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong number or type of arguments for overloaded function clone in three tests from src/tests/testpartio.py #114

@danfe

Description

@danfe

There must be something wrong with generated partioPYTHON_wrap.cxx, observed with partio v1.19.0 on Ubuntu and FreeBSD against SWIG 4.2 and 4.0 alike. I've noticed that bool particles=true (default value) is missing from src/py/partio.i but adding it did not make a difference.

$ grep clone\( src/lib/Partio.h src/py/partio.i
src/lib/Partio.h:ParticlesDataMutable* clone(const ParticlesData&, bool particles=true, const std::map<std::string, std::string>* attrNameMap = nullptr);
src/py/partio.i:ParticlesDataMutable* clone(const ParticlesData& other, bool particles, const std::map<std::string, std::string>* attrNameMap=nullptr);

$ mkdir -p _build && cd _build
$ cmake .. -DPARTIO_GTEST_ENABLED:BOOL=ON
$ make ; echo $?
...
[100%] Built target testmerge
0
$ LD_LIBRARY_PATH=src/lib PYTHONPATH=src/py python3 -B ../src/tests/testpartio.py
...
other = <partio.ParticlesDataMutable; proxy of <Swig Object of type 'ParticlesDataMutable *' at [redacted]> >
particles = True, attrNameMap = None
...
    def clone(other, particles=True, attrNameMap=None):
>       return _partio.clone(other, particles, attrNameMap)
E       TypeError: Wrong number or type of arguments for overloaded function 'clone'.
E         Possible C/C++ prototypes are:
E           clone(ParticlesData const &,bool,std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const *)
E           clone(ParticlesData const &,bool)

src/py/partio.py:510: TypeError
===================================== short test summary info ======================================
FAILED ../src/tests/testpartio.py::test_clone_without_data - TypeError: Wrong number or type of a...
FAILED ../src/tests/testpartio.py::test_clone_with_data - TypeError: Wrong number or type of argu...
FAILED ../src/tests/testpartio.py::test_clone_with_data_and_map_is_none - TypeError: Wrong number...
=================================== 3 failed, 3 passed in 0.05s ====================================

Update: inserting a name into %template() std::map<...> fixes the tests, but that contradicts the nearby comment about "defining our own typemap and using an empty template [...] instantiation, that is, %template with no name". The documentation URL points to the older SWIG version 3.0 so perhaps using an empty template now requires more tweaks and band-aids to work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions