[Bug 717323] New: libstorage.py fails with type error if C++ methods have (non-const) std::string& args
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.
https://bugzilla.novell.com/show_bug.cgi?id=717323 https://bugzilla.novell.com/show_bug.cgi?id=717323#c Arvin Schnell <aschnell@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aschnell@suse.com, | |fehr@suse.com AssignedTo|bnc-team-screening@forge.pr |aschnell@suse.com |ovo.novell.com | -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=717323 https://bugzilla.novell.com/show_bug.cgi?id=717323#c1 Thomas Fehr <fehr@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from Thomas Fehr <fehr@suse.com> 2011-09-13 11:08:54 UTC --- Thank you very much for the hint. I just checking in a fix for python bindings that makes functions that use references to return data usable from python. Fix should be available with next milestone of openSuSE 12.1 -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=717323 https://bugzilla.novell.com/show_bug.cgi?id=717323#c2 --- Comment #2 from Bernhard Wiedemann <bwiedemann@suse.com> 2011-09-16 10:41:17 CEST --- This is an autogenerated message for OBS integration: This bug (717323) was mentioned in https://build.opensuse.org/request/show/82241 -- 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.
participants (1)
-
bugzilla_noreply@novell.com