v3.3.91
This commit is contained in:
parent
223e379afe
commit
a11c6cd0e1
@ -1,28 +0,0 @@
|
||||
diff -up pygobject-3.3.4/tests/Makefile.am.disable-pyflakes-and-pep8-in-check pygobject-3.3.4/tests/Makefile.am
|
||||
--- pygobject-3.3.4/tests/Makefile.am.disable-pyflakes-and-pep8-in-check 2012-08-15 14:00:25.650233579 -0400
|
||||
+++ pygobject-3.3.4/tests/Makefile.am 2012-08-15 14:01:01.924780085 -0400
|
||||
@@ -106,10 +106,6 @@ RUN_TESTS_ENV_VARS= \
|
||||
TESTS_BUILDDIR=$(builddir)
|
||||
|
||||
check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
|
||||
- @echo " CHECK Pyflakes"
|
||||
- pyflakes $(top_srcdir)
|
||||
- @echo " CHECK PEP8"
|
||||
- pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir)
|
||||
$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning $(srcdir)/runtests.py
|
||||
|
||||
check.gdb:
|
||||
diff -up pygobject-3.3.4/tests/Makefile.in.disable-pyflakes-and-pep8-in-check pygobject-3.3.4/tests/Makefile.in
|
||||
--- pygobject-3.3.4/tests/Makefile.in.disable-pyflakes-and-pep8-in-check 2012-08-15 14:00:35.550109812 -0400
|
||||
+++ pygobject-3.3.4/tests/Makefile.in 2012-08-15 14:01:09.717682658 -0400
|
||||
@@ -724,10 +724,6 @@ clean-local:
|
||||
rm -f $(LTLIBRARIES:.la=.so) file.txt~
|
||||
|
||||
check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
|
||||
- @echo " CHECK Pyflakes"
|
||||
- pyflakes $(top_srcdir)
|
||||
- @echo " CHECK PEP8"
|
||||
- pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir)
|
||||
$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning $(srcdir)/runtests.py
|
||||
|
||||
check.gdb:
|
@ -1,701 +0,0 @@
|
||||
Index: pygobject-3.2.2/gi/pygi-argument.c
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-argument.c
|
||||
+++ pygobject-3.2.2/gi/pygi-argument.c
|
||||
@@ -31,6 +31,56 @@
|
||||
#include <pyglib-python-compat.h>
|
||||
#include <pyglib.h>
|
||||
|
||||
+void
|
||||
+_pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ arg->v_int8 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ arg->v_int16 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ arg->v_int32 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UTF8:
|
||||
+ case GI_TYPE_TAG_FILENAME:
|
||||
+ case GI_TYPE_TAG_INTERFACE:
|
||||
+ break;
|
||||
+ default:
|
||||
+ g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gpointer
|
||||
+_pygi_arg_to_hash_pointer (const GIArgument *arg,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ return GINT_TO_POINTER(arg->v_int8);
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ return GINT_TO_POINTER(arg->v_uint8);
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ return GINT_TO_POINTER(arg->v_int16);
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ return GINT_TO_POINTER(arg->v_uint16);
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ return GINT_TO_POINTER(arg->v_int32);
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ return GINT_TO_POINTER(arg->v_uint32);
|
||||
+ case GI_TYPE_TAG_UTF8:
|
||||
+ case GI_TYPE_TAG_FILENAME:
|
||||
+ case GI_TYPE_TAG_INTERFACE:
|
||||
+ return arg->v_pointer;
|
||||
+ default:
|
||||
+ g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
+ return arg->v_pointer;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
_pygi_g_type_tag_py_bounds (GITypeTag type_tag,
|
||||
PyObject **lower,
|
||||
@@ -1122,7 +1172,7 @@ array_success:
|
||||
break;
|
||||
}
|
||||
|
||||
- arg.v_long = PYGLIB_PyLong_AsLong (int_);
|
||||
+ arg.v_int = PYGLIB_PyLong_AsLong (int_);
|
||||
|
||||
Py_DECREF (int_);
|
||||
|
||||
@@ -1295,7 +1345,8 @@ list_item_error:
|
||||
goto hash_table_item_error;
|
||||
}
|
||||
|
||||
- g_hash_table_insert (hash_table, key.v_pointer, value.v_pointer);
|
||||
+ g_hash_table_insert (hash_table, key.v_pointer,
|
||||
+ _pygi_arg_to_hash_pointer(&value, g_type_info_get_tag (value_type_info)));
|
||||
continue;
|
||||
|
||||
hash_table_item_error:
|
||||
@@ -1644,21 +1695,21 @@ _pygi_argument_to_object (GIArgument *a
|
||||
return NULL;
|
||||
|
||||
py_args = PyTuple_New (1);
|
||||
- if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (arg->v_long)) != 0) {
|
||||
+ if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (arg->v_int)) != 0) {
|
||||
Py_DECREF (py_args);
|
||||
Py_DECREF (py_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- object = PyObject_CallFunction (py_type, "l", arg->v_long);
|
||||
+ object = PyObject_CallFunction (py_type, "i", arg->v_int);
|
||||
|
||||
Py_DECREF (py_args);
|
||||
Py_DECREF (py_type);
|
||||
|
||||
} else if (info_type == GI_INFO_TYPE_ENUM) {
|
||||
- object = pyg_enum_from_gtype (type, arg->v_long);
|
||||
+ object = pyg_enum_from_gtype (type, arg->v_int);
|
||||
} else {
|
||||
- object = pyg_flags_from_gtype (type, arg->v_long);
|
||||
+ object = pyg_flags_from_gtype (type, arg->v_int);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1771,6 +1822,7 @@ _pygi_argument_to_object (GIArgument *a
|
||||
break;
|
||||
}
|
||||
|
||||
+ _pygi_hash_pointer_to_arg(&value, g_type_info_get_tag (value_type_info));
|
||||
py_value = _pygi_argument_to_object (&value, value_type_info, item_transfer);
|
||||
if (py_value == NULL) {
|
||||
Py_DECREF (py_key);
|
||||
Index: pygobject-3.2.2/gi/pygi-argument.h
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-argument.h
|
||||
+++ pygobject-3.2.2/gi/pygi-argument.h
|
||||
@@ -30,6 +30,12 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
/* Private */
|
||||
+gpointer _pygi_arg_to_hash_pointer (const GIArgument *arg,
|
||||
+ GITypeTag type_tag);
|
||||
+
|
||||
+void _pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
+ GITypeTag type_tag);
|
||||
+
|
||||
gint _pygi_g_type_interface_check_object (GIBaseInfo *info,
|
||||
PyObject *object);
|
||||
|
||||
Index: pygobject-3.2.2/gi/pygi-cache.c
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-cache.c
|
||||
+++ pygobject-3.2.2/gi/pygi-cache.c
|
||||
@@ -1379,6 +1379,8 @@ _args_cache_generate (GICallableInfo *ca
|
||||
callable_cache->n_to_py_child_args++;
|
||||
}
|
||||
|
||||
+ arg_cache->type_tag = g_type_info_get_tag (type_info);
|
||||
+
|
||||
g_base_info_unref ( (GIBaseInfo *)arg_info);
|
||||
continue;
|
||||
}
|
||||
Index: pygobject-3.2.2/gi/pygi-closure.c
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-closure.c
|
||||
+++ pygobject-3.2.2/gi/pygi-closure.c
|
||||
@@ -28,6 +28,57 @@
|
||||
static GSList* async_free_list;
|
||||
|
||||
static void
|
||||
+_pygi_closure_assign_pyobj_to_retval (gpointer retval, PyObject *object,
|
||||
+ GITypeInfo *type_info,
|
||||
+ GITransfer transfer)
|
||||
+{
|
||||
+ GIArgument arg = _pygi_argument_from_object (object, type_info, transfer);
|
||||
+ GITypeTag type_tag = g_type_info_get_tag (type_info);
|
||||
+
|
||||
+ if (retval == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_BOOLEAN:
|
||||
+ *((ffi_sarg *) retval) = arg.v_boolean;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ *((ffi_sarg *) retval) = arg.v_int8;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ *((ffi_arg *) retval) = arg.v_uint8;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ *((ffi_sarg *) retval) = arg.v_int16;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ *((ffi_arg *) retval) = arg.v_uint16;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ *((ffi_sarg *) retval) = arg.v_int32;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ *((ffi_arg *) retval) = arg.v_uint32;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ *((ffi_sarg *) retval) = arg.v_int64;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ *((ffi_arg *) retval) = arg.v_uint64;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_FLOAT:
|
||||
+ *((gfloat *) retval) = arg.v_float;
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_DOUBLE:
|
||||
+ *((gdouble *) retval) = arg.v_double;
|
||||
+ break;
|
||||
+ default:
|
||||
+ *((GIArgument *) retval) = arg;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
_pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg, PyObject *object,
|
||||
GITypeInfo *type_info,
|
||||
GITransfer transfer)
|
||||
@@ -278,10 +329,10 @@ _pygi_closure_set_out_arguments (GICalla
|
||||
GITransfer transfer = g_callable_info_get_caller_owns (callable_info);
|
||||
if (PyTuple_Check (py_retval)) {
|
||||
PyObject *item = PyTuple_GET_ITEM (py_retval, 0);
|
||||
- _pygi_closure_assign_pyobj_to_out_argument (resp, item,
|
||||
+ _pygi_closure_assign_pyobj_to_retval (resp, item,
|
||||
return_type_info, transfer);
|
||||
} else {
|
||||
- _pygi_closure_assign_pyobj_to_out_argument (resp, py_retval,
|
||||
+ _pygi_closure_assign_pyobj_to_retval (resp, py_retval,
|
||||
return_type_info, transfer);
|
||||
}
|
||||
i_py_retval++;
|
||||
Index: pygobject-3.2.2/gi/pygi-marshal-from-py.c
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-marshal-from-py.c
|
||||
+++ pygobject-3.2.2/gi/pygi-marshal-from-py.c
|
||||
@@ -32,6 +32,119 @@
|
||||
#include "pygi-marshal-cleanup.h"
|
||||
#include "pygi-marshal-from-py.h"
|
||||
|
||||
+gboolean
|
||||
+gi_argument_from_py_ssize_t (GIArgument *arg_out,
|
||||
+ Py_ssize_t size_in,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_VOID:
|
||||
+ case GI_TYPE_TAG_BOOLEAN:
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ goto unhandled_type;
|
||||
+
|
||||
+ /* Ranges assume two's complement */
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ if (size_in >= G_MININT32 && size_in <= G_MAXINT32) {
|
||||
+ arg_out->v_int32 = size_in;
|
||||
+ return TRUE;
|
||||
+ } else {
|
||||
+ goto overflow;
|
||||
+ }
|
||||
+
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ if (size_in >= 0 && size_in <= G_MAXUINT32) {
|
||||
+ arg_out->v_uint32 = size_in;
|
||||
+ return TRUE;
|
||||
+ } else {
|
||||
+ goto overflow;
|
||||
+ }
|
||||
+
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ arg_out->v_int64 = size_in;
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ if (size_in >= 0) {
|
||||
+ arg_out->v_uint64 = size_in;
|
||||
+ return TRUE;
|
||||
+ } else {
|
||||
+ goto overflow;
|
||||
+ }
|
||||
+
|
||||
+ case GI_TYPE_TAG_FLOAT:
|
||||
+ case GI_TYPE_TAG_DOUBLE:
|
||||
+ case GI_TYPE_TAG_GTYPE:
|
||||
+ case GI_TYPE_TAG_UTF8:
|
||||
+ case GI_TYPE_TAG_FILENAME:
|
||||
+ case GI_TYPE_TAG_ARRAY:
|
||||
+ case GI_TYPE_TAG_INTERFACE:
|
||||
+ case GI_TYPE_TAG_GLIST:
|
||||
+ case GI_TYPE_TAG_GSLIST:
|
||||
+ case GI_TYPE_TAG_GHASH:
|
||||
+ case GI_TYPE_TAG_ERROR:
|
||||
+ case GI_TYPE_TAG_UNICHAR:
|
||||
+ default:
|
||||
+ goto unhandled_type;
|
||||
+ }
|
||||
+
|
||||
+ overflow:
|
||||
+ PyErr_Format (PyExc_OverflowError,
|
||||
+ "Unable to marshal C Py_ssize_t %zd to %s",
|
||||
+ size_in,
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+
|
||||
+ unhandled_type:
|
||||
+ PyErr_Format (PyExc_TypeError,
|
||||
+ "Unable to marshal C Py_ssize_t %zd to %s",
|
||||
+ size_in,
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+gi_argument_from_c_long (GIArgument *arg_out,
|
||||
+ long c_long_in,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ arg_out->v_int8 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ arg_out->v_uint8 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ arg_out->v_int16 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ arg_out->v_uint16 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ arg_out->v_int32 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ arg_out->v_uint32 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ arg_out->v_int64 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ arg_out->v_uint64 = c_long_in;
|
||||
+ return TRUE;
|
||||
+ default:
|
||||
+ PyErr_Format (PyExc_TypeError,
|
||||
+ "Unable to marshal C long %ld to %s",
|
||||
+ c_long_in,
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* _is_union_member - check to see if the py_arg is actually a member of the
|
||||
* expected C union
|
||||
@@ -733,33 +846,6 @@ _pygi_marshal_from_py_filename (PyGIInvo
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-static gpointer
|
||||
-_pygi_arg_to_hash_pointer (const GIArgument *arg,
|
||||
- GITypeTag type_tag)
|
||||
-{
|
||||
- switch (type_tag) {
|
||||
- case GI_TYPE_TAG_INT8:
|
||||
- return GINT_TO_POINTER(arg->v_int8);
|
||||
- case GI_TYPE_TAG_UINT8:
|
||||
- return GINT_TO_POINTER(arg->v_uint8);
|
||||
- case GI_TYPE_TAG_INT16:
|
||||
- return GINT_TO_POINTER(arg->v_int16);
|
||||
- case GI_TYPE_TAG_UINT16:
|
||||
- return GINT_TO_POINTER(arg->v_uint16);
|
||||
- case GI_TYPE_TAG_INT32:
|
||||
- return GINT_TO_POINTER(arg->v_int32);
|
||||
- case GI_TYPE_TAG_UINT32:
|
||||
- return GINT_TO_POINTER(arg->v_uint32);
|
||||
- case GI_TYPE_TAG_UTF8:
|
||||
- case GI_TYPE_TAG_FILENAME:
|
||||
- case GI_TYPE_TAG_INTERFACE:
|
||||
- return arg->v_pointer;
|
||||
- default:
|
||||
- g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
- return arg->v_pointer;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
gboolean
|
||||
_pygi_marshal_from_py_array (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
@@ -929,12 +1015,21 @@ array_success:
|
||||
if (child_cache->direction == PYGI_DIRECTION_BIDIRECTIONAL) {
|
||||
gint *len_arg = (gint *)state->in_args[child_cache->c_arg_index].v_pointer;
|
||||
/* if we are not setup yet just set the in arg */
|
||||
- if (len_arg == NULL)
|
||||
- state->in_args[child_cache->c_arg_index].v_long = length;
|
||||
- else
|
||||
+ if (len_arg == NULL) {
|
||||
+ if (!gi_argument_from_py_ssize_t (&state->in_args[child_cache->c_arg_index],
|
||||
+ length,
|
||||
+ child_cache->type_tag)) {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ } else {
|
||||
*len_arg = length;
|
||||
+ }
|
||||
} else {
|
||||
- state->in_args[child_cache->c_arg_index].v_long = length;
|
||||
+ if (!gi_argument_from_py_ssize_t (&state->in_args[child_cache->c_arg_index],
|
||||
+ length,
|
||||
+ child_cache->type_tag)) {
|
||||
+ goto err;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1278,20 +1373,32 @@ _pygi_marshal_from_py_interface_enum (Py
|
||||
PyObject *py_arg,
|
||||
GIArgument *arg)
|
||||
{
|
||||
- PyObject *int_;
|
||||
+ PyObject *py_long;
|
||||
+ long c_long;
|
||||
gint is_instance;
|
||||
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
|
||||
+ GIBaseInfo *interface;
|
||||
|
||||
is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type);
|
||||
|
||||
- int_ = PYGLIB_PyNumber_Long (py_arg);
|
||||
- if (int_ == NULL) {
|
||||
+ py_long = PYGLIB_PyNumber_Long (py_arg);
|
||||
+ if (py_long == NULL) {
|
||||
PyErr_Clear();
|
||||
goto err;
|
||||
}
|
||||
|
||||
- arg->v_long = PYGLIB_PyLong_AsLong (int_);
|
||||
- Py_DECREF (int_);
|
||||
+ c_long = PYGLIB_PyLong_AsLong (py_long);
|
||||
+ Py_DECREF (py_long);
|
||||
+
|
||||
+ /* Write c_long into arg */
|
||||
+ interface = g_type_info_get_interface (arg_cache->type_info);
|
||||
+ assert(g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM);
|
||||
+ if (!gi_argument_from_c_long(arg,
|
||||
+ c_long,
|
||||
+ g_enum_info_get_storage_type ((GIEnumInfo *)interface))) {
|
||||
+ g_assert_not_reached();
|
||||
+ return FALSE;
|
||||
+ }
|
||||
|
||||
/* If this is not an instance of the Enum type that we want
|
||||
* we need to check if the value is equivilant to one of the
|
||||
@@ -1305,7 +1412,7 @@ _pygi_marshal_from_py_interface_enum (Py
|
||||
g_enum_info_get_value (iface_cache->interface_info, i);
|
||||
glong enum_value = g_value_info_get_value (value_info);
|
||||
g_base_info_unref ( (GIBaseInfo *)value_info);
|
||||
- if (arg->v_long == enum_value) {
|
||||
+ if (c_long == enum_value) {
|
||||
is_found = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -1330,25 +1437,35 @@ _pygi_marshal_from_py_interface_flags (P
|
||||
PyObject *py_arg,
|
||||
GIArgument *arg)
|
||||
{
|
||||
- PyObject *int_;
|
||||
+ PyObject *py_long;
|
||||
+ long c_long;
|
||||
gint is_instance;
|
||||
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
|
||||
+ GIBaseInfo *interface;
|
||||
|
||||
is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type);
|
||||
|
||||
- int_ = PYGLIB_PyNumber_Long (py_arg);
|
||||
- if (int_ == NULL) {
|
||||
+ py_long = PYGLIB_PyNumber_Long (py_arg);
|
||||
+ if (py_long == NULL) {
|
||||
PyErr_Clear ();
|
||||
goto err;
|
||||
}
|
||||
|
||||
- arg->v_long = PYGLIB_PyLong_AsLong (int_);
|
||||
- Py_DECREF (int_);
|
||||
+ c_long = PYGLIB_PyLong_AsLong (py_long);
|
||||
+ Py_DECREF (py_long);
|
||||
|
||||
/* only 0 or argument of type Flag is allowed */
|
||||
- if (!is_instance && arg->v_long != 0)
|
||||
+ if (!is_instance && c_long != 0)
|
||||
goto err;
|
||||
|
||||
+ /* Write c_long into arg */
|
||||
+ interface = g_type_info_get_interface (arg_cache->type_info);
|
||||
+ g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS);
|
||||
+ if (!gi_argument_from_c_long(arg, c_long,
|
||||
+ g_enum_info_get_storage_type ((GIEnumInfo *)interface))) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
return TRUE;
|
||||
|
||||
err:
|
||||
Index: pygobject-3.2.2/gi/pygi-marshal-from-py.h
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-marshal-from-py.h
|
||||
+++ pygobject-3.2.2/gi/pygi-marshal-from-py.h
|
||||
@@ -30,6 +30,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
+gboolean _pygi_marshal_from_py_ssize_t (PyGIArgCache *arg_cache,
|
||||
+ Py_ssize_t size,
|
||||
+ GIArgument *arg);
|
||||
gboolean _pygi_marshal_from_py_void (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
PyGIArgCache *arg_cache,
|
||||
Index: pygobject-3.2.2/gi/pygi-marshal-to-py.c
|
||||
===================================================================
|
||||
--- pygobject-3.2.2.orig/gi/pygi-marshal-to-py.c
|
||||
+++ pygobject-3.2.2/gi/pygi-marshal-to-py.c
|
||||
@@ -34,6 +34,83 @@
|
||||
#include "pygi-marshal-cleanup.h"
|
||||
#include "pygi-marshal-to-py.h"
|
||||
|
||||
+gboolean
|
||||
+gi_argument_to_c_long (GIArgument *arg_in,
|
||||
+ long *c_long_out,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ *c_long_out = arg_in->v_int8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ *c_long_out = arg_in->v_uint8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ *c_long_out = arg_in->v_int16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ *c_long_out = arg_in->v_uint16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ *c_long_out = arg_in->v_int32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ *c_long_out = arg_in->v_uint32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ *c_long_out = arg_in->v_int64;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ *c_long_out = arg_in->v_uint64;
|
||||
+ return TRUE;
|
||||
+ default:
|
||||
+ PyErr_Format (PyExc_TypeError,
|
||||
+ "Unable to marshal %s to C long",
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+gi_argument_to_gsize (GIArgument *arg_in,
|
||||
+ gsize *gsize_out,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ *gsize_out = arg_in->v_int8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ *gsize_out = arg_in->v_uint8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ *gsize_out = arg_in->v_int16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ *gsize_out = arg_in->v_uint16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ *gsize_out = arg_in->v_int32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ *gsize_out = arg_in->v_uint32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ *gsize_out = arg_in->v_int64;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ *gsize_out = arg_in->v_uint64;
|
||||
+ return TRUE;
|
||||
+ default:
|
||||
+ PyErr_Format (PyExc_TypeError,
|
||||
+ "Unable to marshal %s to gsize",
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
PyObject *
|
||||
_pygi_marshal_to_py_void (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
@@ -284,7 +361,12 @@ _pygi_marshal_to_py_array (PyGIInvokeSta
|
||||
}
|
||||
} else {
|
||||
GIArgument *len_arg = state->args[seq_cache->len_arg_index];
|
||||
- len = len_arg->v_long;
|
||||
+
|
||||
+ if (!gi_argument_to_gsize (len_arg,
|
||||
+ &len,
|
||||
+ callable_cache->args_cache[seq_cache->len_arg_index]->type_tag)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
array_ = g_array_new (FALSE,
|
||||
@@ -415,29 +497,6 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static void
|
||||
-_pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
- GITypeTag type_tag)
|
||||
-{
|
||||
- switch (type_tag) {
|
||||
- case GI_TYPE_TAG_INT8:
|
||||
- arg->v_int8 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
- break;
|
||||
- case GI_TYPE_TAG_INT16:
|
||||
- arg->v_int16 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
- break;
|
||||
- case GI_TYPE_TAG_INT32:
|
||||
- arg->v_int32 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
- break;
|
||||
- case GI_TYPE_TAG_UTF8:
|
||||
- case GI_TYPE_TAG_FILENAME:
|
||||
- case GI_TYPE_TAG_INTERFACE:
|
||||
- break;
|
||||
- default:
|
||||
- g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
- }
|
||||
-}
|
||||
-
|
||||
PyObject *
|
||||
_pygi_marshal_to_py_glist (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
@@ -664,11 +723,21 @@ _pygi_marshal_to_py_interface_enum (PyGI
|
||||
{
|
||||
PyObject *py_obj = NULL;
|
||||
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
|
||||
+ GIBaseInfo *interface;
|
||||
+ long c_long;
|
||||
+
|
||||
+ interface = g_type_info_get_interface (arg_cache->type_info);
|
||||
+ g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM);
|
||||
+
|
||||
+ if (!gi_argument_to_c_long(arg, &c_long,
|
||||
+ g_enum_info_get_storage_type ((GIEnumInfo *)interface))) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
if (iface_cache->g_type == G_TYPE_NONE) {
|
||||
- py_obj = PyObject_CallFunction (iface_cache->py_type, "l", arg->v_long);
|
||||
+ py_obj = PyObject_CallFunction (iface_cache->py_type, "l", c_long);
|
||||
} else {
|
||||
- py_obj = pyg_enum_from_gtype (iface_cache->g_type, arg->v_long);
|
||||
+ py_obj = pyg_enum_from_gtype (iface_cache->g_type, c_long);
|
||||
}
|
||||
return py_obj;
|
||||
}
|
||||
@@ -681,6 +750,16 @@ _pygi_marshal_to_py_interface_flags (PyG
|
||||
{
|
||||
PyObject *py_obj = NULL;
|
||||
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
|
||||
+ GIBaseInfo *interface;
|
||||
+ long c_long;
|
||||
+
|
||||
+ interface = g_type_info_get_interface (arg_cache->type_info);
|
||||
+ g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS);
|
||||
+
|
||||
+ if (!gi_argument_to_c_long(arg, &c_long,
|
||||
+ g_enum_info_get_storage_type ((GIEnumInfo *)interface))) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
if (iface_cache->g_type == G_TYPE_NONE) {
|
||||
/* An enum with a GType of None is an enum without GType */
|
||||
@@ -692,18 +771,18 @@ _pygi_marshal_to_py_interface_flags (PyG
|
||||
return NULL;
|
||||
|
||||
py_args = PyTuple_New (1);
|
||||
- if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (arg->v_long)) != 0) {
|
||||
+ if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (c_long)) != 0) {
|
||||
Py_DECREF (py_args);
|
||||
Py_DECREF (py_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- py_obj = PyObject_CallFunction (py_type, "l", arg->v_long);
|
||||
+ py_obj = PyObject_CallFunction (py_type, "l", c_long);
|
||||
|
||||
Py_DECREF (py_args);
|
||||
Py_DECREF (py_type);
|
||||
} else {
|
||||
- py_obj = pyg_flags_from_gtype (iface_cache->g_type, arg->v_long);
|
||||
+ py_obj = pyg_flags_from_gtype (iface_cache->g_type, c_long);
|
||||
}
|
||||
|
||||
return py_obj;
|
@ -1,147 +0,0 @@
|
||||
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
|
||||
index b885ba0..2eff676 100644
|
||||
--- a/gi/pygi-argument.c
|
||||
+++ b/gi/pygi-argument.c
|
||||
@@ -31,6 +31,44 @@
|
||||
#include <pyglib-python-compat.h>
|
||||
#include <pyglib.h>
|
||||
|
||||
+static gboolean
|
||||
+gi_argument_to_gssize (GIArgument *arg_in,
|
||||
+ GITypeTag type_tag,
|
||||
+ gssize *gssize_out)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ *gssize_out = arg_in->v_int8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ *gssize_out = arg_in->v_uint8;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ *gssize_out = arg_in->v_int16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ *gssize_out = arg_in->v_uint16;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ *gssize_out = arg_in->v_int32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ *gssize_out = arg_in->v_uint32;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_INT64:
|
||||
+ *gssize_out = arg_in->v_int64;
|
||||
+ return TRUE;
|
||||
+ case GI_TYPE_TAG_UINT64:
|
||||
+ *gssize_out = arg_in->v_uint64;
|
||||
+ return TRUE;
|
||||
+ default:
|
||||
+ PyErr_Format (PyExc_TypeError,
|
||||
+ "Unable to marshal %s to gssize",
|
||||
+ g_type_tag_to_string(type_tag));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
_pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
GITypeTag type_tag)
|
||||
@@ -708,6 +746,7 @@ check_number_release:
|
||||
* @arg: The argument to convert
|
||||
* @args: Arguments to method invocation, possibly contaning the array length.
|
||||
* Set to NULL if this is not for a method call
|
||||
+ * @callable_info: Info on the callable, if this a method call; otherwise NULL
|
||||
* @type_info: The type info for @arg
|
||||
* @out_free_array: A return location for a gboolean that indicates whether
|
||||
* or not the wrapped GArray should be freed
|
||||
@@ -725,6 +764,7 @@ check_number_release:
|
||||
GArray *
|
||||
_pygi_argument_to_array (GIArgument *arg,
|
||||
GIArgument *args[],
|
||||
+ GICallableInfo *callable_info,
|
||||
GITypeInfo *type_info,
|
||||
gboolean *out_free_array)
|
||||
{
|
||||
@@ -762,12 +802,19 @@ _pygi_argument_to_array (GIArgument *arg,
|
||||
return g_array;
|
||||
}
|
||||
gint length_arg_pos;
|
||||
+ GIArgInfo *length_arg_info;
|
||||
+ GITypeInfo *length_type_info;
|
||||
|
||||
length_arg_pos = g_type_info_get_array_length (type_info);
|
||||
g_assert (length_arg_pos >= 0);
|
||||
-
|
||||
- /* FIXME: Take into account the type of the length argument */
|
||||
- length = args[length_arg_pos]->v_int;
|
||||
+ g_assert (callable_info);
|
||||
+ length_arg_info = g_callable_info_get_arg(callable_info, length_arg_pos);
|
||||
+ length_type_info = g_arg_info_get_type(length_arg_info);
|
||||
+ if (!gi_argument_to_gssize (args[length_arg_pos],
|
||||
+ g_type_info_get_tag(length_type_info),
|
||||
+ &length)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gi/pygi-argument.h b/gi/pygi-argument.h
|
||||
index 1b9ef1d..1785f8f 100644
|
||||
--- a/gi/pygi-argument.h
|
||||
+++ b/gi/pygi-argument.h
|
||||
@@ -50,6 +50,7 @@ gint _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
|
||||
|
||||
GArray* _pygi_argument_to_array (GIArgument *arg,
|
||||
GIArgument *args[],
|
||||
+ GICallableInfo *callable_info,
|
||||
GITypeInfo *type_info,
|
||||
gboolean *out_free_array);
|
||||
|
||||
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
|
||||
index 824d620..59721af 100644
|
||||
--- a/gi/pygi-closure.c
|
||||
+++ b/gi/pygi-closure.c
|
||||
@@ -351,6 +351,7 @@ _pygi_closure_convert_arguments (GICallableInfo *callable_info, void **args,
|
||||
|
||||
if (g_type_info_get_tag (arg_type) == GI_TYPE_TAG_ARRAY)
|
||||
arg->v_pointer = _pygi_argument_to_array (arg, args,
|
||||
+ callable_info,
|
||||
arg_type, &free_array);
|
||||
|
||||
value = _pygi_argument_to_object (arg, arg_type, transfer);
|
||||
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
|
||||
index 9f92cd3..3ca5c8f 100644
|
||||
--- a/gi/pygi-info.c
|
||||
+++ b/gi/pygi-info.c
|
||||
@@ -1157,7 +1157,7 @@ _wrap_g_constant_info_get_value (PyGIBaseInfo *self)
|
||||
type_info = g_constant_info_get_type ( (GIConstantInfo *) self->info);
|
||||
|
||||
if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ARRAY) {
|
||||
- value.v_pointer = _pygi_argument_to_array (&value, NULL,
|
||||
+ value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL,
|
||||
type_info, &free_array);
|
||||
}
|
||||
|
||||
@@ -1290,7 +1290,7 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
|
||||
}
|
||||
|
||||
if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_ARRAY) {
|
||||
- value.v_pointer = _pygi_argument_to_array (&value, NULL,
|
||||
+ value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL,
|
||||
field_type_info, &free_array);
|
||||
}
|
||||
|
||||
diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c
|
||||
index 4e9dcb5..83f9a41 100644
|
||||
--- a/gi/pygi-signal-closure.c
|
||||
+++ b/gi/pygi-signal-closure.c
|
||||
@@ -154,7 +154,7 @@ pygi_signal_closure_marshal(GClosure *closure,
|
||||
arg = _pygi_argument_from_g_value(¶m_values[i], &type_info);
|
||||
|
||||
if (g_type_info_get_tag (&type_info) == GI_TYPE_TAG_ARRAY) {
|
||||
- arg.v_pointer = _pygi_argument_to_array (&arg, NULL,
|
||||
+ arg.v_pointer = _pygi_argument_to_array (&arg, NULL, NULL,
|
||||
&type_info, &free_array);
|
||||
}
|
||||
|
@ -1,185 +0,0 @@
|
||||
From 770e6abfd5bc5dad7d5f56a18f1ef63f9754ada9 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Pitt <martinpitt@gnome.org>
|
||||
Date: Fri, 03 Aug 2012 04:45:48 +0000
|
||||
Subject: Fix list marshalling on big-endian machines
|
||||
|
||||
On big endian machines we cannot simply set e. g. GIArgument.v_int8 and expect
|
||||
GIArgument.v_pointer to be a correct representation. This needs to use
|
||||
GINT_TO_POINTER/GPOINTER_TO_INT properly, so use the already existing
|
||||
_pygi_hash_pointer_to_arg()/_pygi_arg_to_hash_pointer() methods in marshalling
|
||||
to and from GList and GSList, and handle int8 and int16 as well.
|
||||
|
||||
Part of porting pygobject to ppc64:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=842880
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=680693
|
||||
---
|
||||
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
|
||||
index 26c08c9..5437e33 100644
|
||||
--- a/gi/pygi-marshal-from-py.c
|
||||
+++ b/gi/pygi-marshal-from-py.c
|
||||
@@ -736,6 +736,33 @@ _pygi_marshal_from_py_filename (PyGIInvokeState *state,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+static gpointer
|
||||
+_pygi_arg_to_hash_pointer (const GIArgument *arg,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ return GINT_TO_POINTER(arg->v_int8);
|
||||
+ case GI_TYPE_TAG_UINT8:
|
||||
+ return GINT_TO_POINTER(arg->v_uint8);
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ return GINT_TO_POINTER(arg->v_int16);
|
||||
+ case GI_TYPE_TAG_UINT16:
|
||||
+ return GINT_TO_POINTER(arg->v_uint16);
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ return GINT_TO_POINTER(arg->v_int32);
|
||||
+ case GI_TYPE_TAG_UINT32:
|
||||
+ return GINT_TO_POINTER(arg->v_uint32);
|
||||
+ case GI_TYPE_TAG_UTF8:
|
||||
+ case GI_TYPE_TAG_FILENAME:
|
||||
+ case GI_TYPE_TAG_INTERFACE:
|
||||
+ return arg->v_pointer;
|
||||
+ default:
|
||||
+ g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
+ return arg->v_pointer;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
gboolean
|
||||
_pygi_marshal_from_py_array (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
@@ -985,7 +1012,7 @@ _pygi_marshal_from_py_glist (PyGIInvokeState *state,
|
||||
&item))
|
||||
goto err;
|
||||
|
||||
- list_ = g_list_prepend (list_, item.v_pointer);
|
||||
+ list_ = g_list_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag));
|
||||
continue;
|
||||
err:
|
||||
/* FIXME: clean up list
|
||||
@@ -1052,7 +1079,7 @@ _pygi_marshal_from_py_gslist (PyGIInvokeState *state,
|
||||
&item))
|
||||
goto err;
|
||||
|
||||
- list_ = g_slist_prepend (list_, item.v_pointer);
|
||||
+ list_ = g_slist_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag));
|
||||
continue;
|
||||
err:
|
||||
/* FIXME: Clean up list
|
||||
@@ -1070,23 +1097,6 @@ err:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-static gpointer
|
||||
-_pygi_arg_to_hash_pointer (const GIArgument *arg,
|
||||
- GITypeTag type_tag)
|
||||
-{
|
||||
- switch (type_tag) {
|
||||
- case GI_TYPE_TAG_INT32:
|
||||
- return GINT_TO_POINTER(arg->v_int32);
|
||||
- case GI_TYPE_TAG_UTF8:
|
||||
- case GI_TYPE_TAG_FILENAME:
|
||||
- case GI_TYPE_TAG_INTERFACE:
|
||||
- return arg->v_pointer;
|
||||
- default:
|
||||
- g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
- return arg->v_pointer;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
gboolean
|
||||
_pygi_marshal_from_py_ghash (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
|
||||
index 3af443d..b906aa2 100644
|
||||
--- a/gi/pygi-marshal-to-py.c
|
||||
+++ b/gi/pygi-marshal-to-py.c
|
||||
@@ -415,6 +415,29 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static void
|
||||
+_pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
+ GITypeTag type_tag)
|
||||
+{
|
||||
+ switch (type_tag) {
|
||||
+ case GI_TYPE_TAG_INT8:
|
||||
+ arg->v_int8 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT16:
|
||||
+ arg->v_int16 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_INT32:
|
||||
+ arg->v_int32 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
+ break;
|
||||
+ case GI_TYPE_TAG_UTF8:
|
||||
+ case GI_TYPE_TAG_FILENAME:
|
||||
+ case GI_TYPE_TAG_INTERFACE:
|
||||
+ break;
|
||||
+ default:
|
||||
+ g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
PyObject *
|
||||
_pygi_marshal_to_py_glist (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
@@ -446,10 +469,11 @@ _pygi_marshal_to_py_glist (PyGIInvokeState *state,
|
||||
PyObject *py_item;
|
||||
|
||||
item_arg.v_pointer = list_->data;
|
||||
- py_item = item_to_py_marshaller ( state,
|
||||
- callable_cache,
|
||||
- item_arg_cache,
|
||||
- &item_arg);
|
||||
+ _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_tag);
|
||||
+ py_item = item_to_py_marshaller (state,
|
||||
+ callable_cache,
|
||||
+ item_arg_cache,
|
||||
+ &item_arg);
|
||||
|
||||
if (py_item == NULL) {
|
||||
Py_CLEAR (py_obj);
|
||||
@@ -494,10 +518,11 @@ _pygi_marshal_to_py_gslist (PyGIInvokeState *state,
|
||||
PyObject *py_item;
|
||||
|
||||
item_arg.v_pointer = list_->data;
|
||||
- py_item = item_to_py_marshaller ( state,
|
||||
+ _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_tag);
|
||||
+ py_item = item_to_py_marshaller (state,
|
||||
callable_cache,
|
||||
item_arg_cache,
|
||||
- &item_arg);
|
||||
+ &item_arg);
|
||||
|
||||
if (py_item == NULL) {
|
||||
Py_CLEAR (py_obj);
|
||||
@@ -511,23 +536,6 @@ _pygi_marshal_to_py_gslist (PyGIInvokeState *state,
|
||||
return py_obj;
|
||||
}
|
||||
|
||||
-static void
|
||||
-_pygi_hash_pointer_to_arg (GIArgument *arg,
|
||||
- GITypeTag type_tag)
|
||||
-{
|
||||
- switch (type_tag) {
|
||||
- case GI_TYPE_TAG_INT32:
|
||||
- arg->v_int32 = GPOINTER_TO_INT(arg->v_pointer);
|
||||
- break;
|
||||
- case GI_TYPE_TAG_UTF8:
|
||||
- case GI_TYPE_TAG_FILENAME:
|
||||
- case GI_TYPE_TAG_INTERFACE:
|
||||
- break;
|
||||
- default:
|
||||
- g_critical("Unsupported type %s", g_type_tag_to_string(type_tag));
|
||||
- }
|
||||
-}
|
||||
-
|
||||
PyObject *
|
||||
_pygi_marshal_to_py_ghash (PyGIInvokeState *state,
|
||||
PyGICallableCache *callable_cache,
|
||||
--
|
||||
cgit v0.9.0.2
|
@ -1,30 +1,26 @@
|
||||
diff -up pygobject-3.3.4/tests/Makefile.am.ignore-more-pep8-errors pygobject-3.3.4/tests/Makefile.am
|
||||
--- pygobject-3.3.4/tests/Makefile.am.ignore-more-pep8-errors 2012-06-22 07:16:12.000000000 -0400
|
||||
+++ pygobject-3.3.4/tests/Makefile.am 2012-08-08 18:00:56.132870559 -0400
|
||||
@@ -107,9 +107,9 @@ RUN_TESTS_ENV_VARS= \
|
||||
|
||||
check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
|
||||
Index: pygobject-3.3.91/tests/Makefile.am
|
||||
===================================================================
|
||||
--- pygobject-3.3.91.orig/tests/Makefile.am
|
||||
+++ pygobject-3.3.91/tests/Makefile.am
|
||||
@@ -118,7 +118,7 @@ check-local: $(LTLIBRARIES:.la=.so) Regr
|
||||
@echo " CHECK Pyflakes"
|
||||
- @pyflakes $(top_srcdir)
|
||||
+ pyflakes $(top_srcdir)
|
||||
@if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
|
||||
@echo " CHECK PEP8"
|
||||
- @pep8 --ignore=E501,E123 --repeat --show-source $(top_srcdir)
|
||||
+ pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir)
|
||||
- @if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi
|
||||
+ @if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi
|
||||
$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning $(srcdir)/runtests.py
|
||||
|
||||
check.gdb:
|
||||
diff -up pygobject-3.3.4/tests/Makefile.in.ignore-more-pep8-errors pygobject-3.3.4/tests/Makefile.in
|
||||
--- pygobject-3.3.4/tests/Makefile.in.ignore-more-pep8-errors 2012-08-08 18:08:37.813838989 -0400
|
||||
+++ pygobject-3.3.4/tests/Makefile.in 2012-08-08 18:08:50.877838097 -0400
|
||||
@@ -725,9 +725,9 @@ clean-local:
|
||||
|
||||
check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
|
||||
Index: pygobject-3.3.91/tests/Makefile.in
|
||||
===================================================================
|
||||
--- pygobject-3.3.91.orig/tests/Makefile.in
|
||||
+++ pygobject-3.3.91/tests/Makefile.in
|
||||
@@ -736,7 +736,7 @@ check-local: $(LTLIBRARIES:.la=.so) Regr
|
||||
@echo " CHECK Pyflakes"
|
||||
- @pyflakes $(top_srcdir)
|
||||
+ pyflakes $(top_srcdir)
|
||||
@if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
|
||||
@echo " CHECK PEP8"
|
||||
- @pep8 --ignore=E501,E123 --repeat --show-source $(top_srcdir)
|
||||
+ pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir)
|
||||
- @if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi
|
||||
+ @if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124,E127 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi
|
||||
$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning $(srcdir)/runtests.py
|
||||
|
||||
check.gdb:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Last updated for version 2.21.0
|
||||
%define glib2_version 2.22.4
|
||||
%define gobject_introspection_version 0.10.8
|
||||
%define gobject_introspection_version 1.33.9
|
||||
%define python2_version 2.3.5
|
||||
|
||||
%if 0%{?fedora} > 12
|
||||
@ -21,8 +21,8 @@
|
||||
### Abstract ###
|
||||
|
||||
Name: pygobject3
|
||||
Version: 3.3.4
|
||||
Release: 9%{?dist}
|
||||
Version: 3.3.91
|
||||
Release: 1%{?dist}
|
||||
License: LGPLv2+ and MIT
|
||||
Group: Development/Languages
|
||||
Summary: Python 2 bindings for GObject Introspection
|
||||
@ -31,7 +31,6 @@ URL: https://live.gnome.org/PyGObject
|
||||
Source: http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.3/pygobject-%{version}.tar.xz
|
||||
|
||||
# Add these additional exclusions to the pep8 rules in "make check":
|
||||
# E124 closing bracket does not match visual indentation
|
||||
# E127 continuation line over-indented for visual indent
|
||||
# Not yet sent upstream
|
||||
Patch1: ignore-more-pep8-errors.patch
|
||||
@ -66,23 +65,9 @@ Patch1: ignore-more-pep8-errors.patch
|
||||
# Not yet sent upstream
|
||||
Patch2: pygobject-3.3.4-known-failures.patch
|
||||
|
||||
# Fix various endianness issues that broke things on big-endian 64 bit boxes
|
||||
# (rhbz#841596; attachment 603367):
|
||||
Patch3: endianness-fixes.patch
|
||||
|
||||
# Cherrypick fix from upstream (in 3.3.5 onwards; rhbz#842880):
|
||||
Patch4: fix-list-marshalling-on-big-endian-machines.patch
|
||||
|
||||
# Add regression test for rhbz#842880
|
||||
# Not yet sent upstream:
|
||||
Patch5: test-list-marshalling.patch
|
||||
|
||||
# Fix endianness issue in _pygi_argument_to_array (rhbz#841596;
|
||||
# attachment 603634):
|
||||
Patch6: fix-argument-to-array.patch
|
||||
|
||||
# Avoid dragging pyflakes and python-pep8 into RHEL:
|
||||
Patch7: disable-pyflakes-and-pep8-in-check.patch
|
||||
Patch3: test-list-marshalling.patch
|
||||
|
||||
### Build Dependencies ###
|
||||
|
||||
@ -154,17 +139,7 @@ for use in Python 3 programs.
|
||||
%setup -q -n pygobject-%{version}
|
||||
%patch1 -p1 -b .ignore-more-pep8-errors
|
||||
%patch2 -p1 -b .known-failures
|
||||
|
||||
# Patch 3 now partly undoes part of patch 4, so they're in reverse order:
|
||||
%patch4 -p1 -b .fix-list-marshalling-on-big-endian-machines
|
||||
%patch3 -p1 -b .endianness-fixes
|
||||
|
||||
%patch5 -p1 -b .test-list-marshalling
|
||||
%patch6 -p1 -b .fix-argument-to-array
|
||||
|
||||
%if !0%{?fedora}
|
||||
%patch7 -p1 -b .disable-pyflakes-and-pep8-in-check
|
||||
%endif
|
||||
%patch3 -p1 -b .test-list-marshalling
|
||||
|
||||
%if 0%{?with_python3}
|
||||
rm -rf %{py3dir}
|
||||
@ -262,6 +237,9 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
|
||||
%endif # with_python3
|
||||
|
||||
%changelog
|
||||
* Thu Sep 13 2012 Daniel Drake <dsd@laptop.org> - 3.3.91-1
|
||||
- Latest version; upstreamed patches dropped
|
||||
|
||||
* Wed Aug 15 2012 David Malcolm <dmalcolm@redhat.com> - 3.3.4-9
|
||||
- avoid dragging pyflakes and python-pep8 into RHEL (patch 7)
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
676dc96593362b7b0aa54fea0c8e744c pygobject-3.3.4.tar.xz
|
||||
30967ad59df8fc604e92acc0f5254d90 pygobject-3.3.91.tar.xz
|
||||
|
@ -1,15 +1,13 @@
|
||||
diff -up pygobject-3.3.4/tests/test_overrides.py.test-list-marshalling pygobject-3.3.4/tests/test_overrides.py
|
||||
--- pygobject-3.3.4/tests/test_overrides.py.test-list-marshalling 2012-07-04 02:42:46.000000000 -0400
|
||||
+++ pygobject-3.3.4/tests/test_overrides.py 2012-08-09 14:54:26.783741969 -0400
|
||||
@@ -1981,6 +1981,11 @@ class TestGtk(unittest.TestCase):
|
||||
self.assertEqual(viewport.props.vadjustment, vadjustment)
|
||||
self.assertEqual(viewport.props.hadjustment, hadjustment)
|
||||
|
||||
Index: pygobject-3.3.91/tests/test_overrides_gtk.py
|
||||
===================================================================
|
||||
--- pygobject-3.3.91.orig/tests/test_overrides_gtk.py
|
||||
+++ pygobject-3.3.91/tests/test_overrides_gtk.py
|
||||
@@ -1553,3 +1553,8 @@ class TestTextBuffer(unittest.TestCase):
|
||||
None)
|
||||
self.assertEqual(start.get_offset(), 6)
|
||||
self.assertEqual(end.get_offset(), 11)
|
||||
+
|
||||
+ def test_rhbz842880(self):
|
||||
+ # Regression test for https://bugzilla.redhat.com/show_bug.cgi?id=842880
|
||||
+ store = Gtk.ListStore(int, int)
|
||||
+ store.append([1, 2])
|
||||
+
|
||||
|
||||
class TestGio(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
Loading…
Reference in New Issue
Block a user