GNOME Bugzilla – Bug 334548
Proper use of PyTuple and PyList for return values
Last modified: 2006-07-03 09:02:00 UTC
PyTuple should be used for immutable collection of different type of objects, whereas PyList should be used for mutable collection of same type of objects. See http://www.python.org/doc/faq/general/#why-are-there-separate-tuple-and-list-data-types for more explanation.
Created attachment 61235 [details] [review] Proper use of PyTuple and PyList in return values of overrides.
Created attachment 61236 [details] [review] same patch with function names
I think this is fine. These functions all belong to the class that is usually used like "foo, bar = do_baz()", so you never see the actual object anyway. I don't see a problem with this change.
Delaying this to after release and should use attached patch by johan that uses Py_BuildValue but that wasn't tested.
Created attachment 61237 [details] [review] Johan Dahlin's patch Better version using Py_BuildValue, has to be reviewed and tested for refcount issues.
2006-07-03 Johan Dahlin <jdahlin@async.com.br> reviewed by: Edward Hervey <edward@fluendo.com> * gst/gstelement.override: * gst/gstevent.override: * gst/gstmessage.override: * gst/gstpad.override: * gst/gstquery.override: Use Py_BuildValue to construct tuples. Use tuples for collection of different objects. See http://www.python.org/doc/faq/general/#why-are-there-separate-tuple-and-list-data-types * testsuite/test_event.py: [message|query|event].parse_* now return tuples and not list. Fixes #334548