diff options
author | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-04-27 21:33:25 +0300 |
---|---|---|
committer | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-04-28 16:54:21 +0300 |
commit | 38f3debf5568e8078dc41e2f6979c0dce6a19075 (patch) | |
tree | 12f77ca6b151684b03f19b162091235ab736383d /gio | |
parent | e1cc4ee2bd408b5b8ad8d4d071ab2654786ddaba (diff) | |
download | pygobject-38f3debf5568e8078dc41e2f6979c0dce6a19075.tar.gz pygobject-38f3debf5568e8078dc41e2f6979c0dce6a19075.tar.xz pygobject-38f3debf5568e8078dc41e2f6979c0dce6a19075.zip |
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.)
Diffstat (limited to 'gio')
-rw-r--r-- | gio/gfile.override | 39 | ||||
-rw-r--r-- | gio/gio.defs | 2 |
2 files changed, 31 insertions, 10 deletions
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" |