From 38f3debf5568e8078dc41e2f6979c0dce6a19075 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Mon, 27 Apr 2009 21:33:25 +0300 Subject: Swap first two arguments of gio.File.query_info_async() Swap the arguments for consistency with other methods. Update documentation accordingly. Take care to keep the old code (i.e. with non-swapped calling arguments) working, but don't mention that anywhere. (Bug #580490.) --- gio/gfile.override | 39 ++++++++++++++++++++++++++++++--------- gio/gio.defs | 2 +- 2 files changed, 31 insertions(+), 10 deletions(-) (limited to 'gio') diff --git a/gio/gfile.override b/gio/gfile.override index 52fc263..7f369c5 100644 --- a/gio/gfile.override +++ b/gio/gfile.override @@ -1015,7 +1015,7 @@ override g_file_query_info_async kwargs static PyObject * _wrap_g_file_query_info_async(PyGObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "callback", "attributes", "flags", + static char *kwlist[] = { "attributes", "callback", "flags", "io_priority", "cancellable", "user_data", NULL }; GCancellable *cancellable; PyGObject *pycancellable = NULL; @@ -1028,14 +1028,35 @@ _wrap_g_file_query_info_async(PyGObject *self, PyObject *args, PyObject *kwargs) notify = pygio_notify_new(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "Os|OiOO:File.query_info_async", - kwlist, - ¬ify->callback, - &attributes, - &flags, &io_priority, - &pycancellable, - ¬ify->data)) - goto error; + "sO|OiOO:File.query_info_async", + kwlist, + &attributes, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) { + /* To preserve compatibility with 2.16 we also allow swapped + * 'attributes' and 'callback'. FIXME: Remove for 3.0. */ + static char *old_kwlist[] = { "callback", "attributes", "flags", + "io_priority", "cancellable", "user_data", NULL }; + PyObject *exc_type, *exc_value, *exc_traceback; + + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Os|OiOO:File.query_info_async", + old_kwlist, + ¬ify->callback, + &attributes, + &flags, &io_priority, + &pycancellable, + ¬ify->data) + || !pygio_notify_callback_is_valid(notify)) { + /* Report the error with new parameters. */ + PyErr_Restore(exc_type, exc_value, exc_traceback); + goto error; + } + } if (!pygio_notify_callback_is_valid(notify)) goto error; diff --git a/gio/gio.defs b/gio/gio.defs index 14c44e7..033ed3e 100644 --- a/gio/gio.defs +++ b/gio/gio.defs @@ -1750,7 +1750,7 @@ ;; (define-method query_info_async (docstring - "F.query_info_async(callback, attributes, [flags, [io_priority,\n" + "F.query_info_async(attributes, callback, [flags, [io_priority,\n" " [cancellable, [user_data]]]]) -> query attributes\n" "\n" "Asynchronously gets the requested information about specified file.\n" -- cgit