https://bugzilla.novell.com/show_bug.cgi?id=717323 https://bugzilla.novell.com/show_bug.cgi?id=717323#c0 Summary: libstorage.py fails with type error if C++ methods have (non-const) std::string& args Classification: openSUSE Product: openSUSE 11.3 Version: Final Platform: All OS/Version: openSUSE 11.3 Status: NEW Severity: Major Priority: P5 - None Component: YaST2 AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: rawipfel@gmail.com QAContact: jsrain@suse.com Found By: --- Blocker: --- Created an attachment (id=450303) --> (http://bugzilla.novell.com/attachment.cgi?id=450303) Modified SWIG file for generating Libstorage Python bindings User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1 Any of the C++ Libstorage methods that require a pass by reference std::string& arg will fail if called from the SWIG-generated Libpython.py wrapper code. Example below, for createLvmLv() Reproducible: Always Steps to Reproduce: linux-l4tr:/home/rwipfel/Desktop # cat createVolume.py #!/usr/bin/python import libstorage env = libstorage.Environment(False) storageInterface = libstorage.createStorageInterface(env) dev=str() storageInterface.createLvmLv("Pool", "test", 102400, 1, dev) libstorage.destroyStorageInterface(storageInterface) Actual Results: linux-l4tr:/home/rwipfel/Desktop # ./createVolume.py Traceback (most recent call last): File "./createVolume.py", line 9, in <module> storageInterface.createLvmLv("Pool", "test", 102400, 1, dev) File "/usr/lib/python2.6/site-packages/libstorage.py", line 1451, in createLvmLv def createLvmLv(self, *args): return _libstorage.StorageInterface_createLvmLv(self, *args) TypeError: in method 'StorageInterface_createLvmLv', argument 6 of type 'string &' Expected Results: See http://old.nabble.com/std%3A%3Astring--typemap-for-python-td29720065.html Please see attached libstorage.i for a SWIG file that creates Python bindings for libstorage that work as below. The pass by reference std::string& device name is instead returned in a tuple containing also the return code. See below for example code and expected output. #!/usr/bin/python import libstorage env = libstorage.Environment(False) storageInterface = libstorage.createStorageInterface(env) print storageInterface.createLvmLv("Pool", "test", 102400, 1) storageInterface.commit() libstorage.destroyStorageInterface(storageInterface) linux-l4tr:/home/rwipfel/Desktop # ./createVolume.py [0, '/dev/Pool/test'] -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.