3.2.2-5: add endianness patch (rhbz#841596; backport of attachment 603634)

This commit is contained in:
David Malcolm 2012-08-10 16:59:06 -04:00
parent 1b9be32b73
commit d6190d2395
2 changed files with 114 additions and 1 deletions

104
fix-argument-to-array.patch Normal file
View File

@ -0,0 +1,104 @@
diff -up pygobject-3.2.2/gi/pygi-argument.c.fix-argument-to-array pygobject-3.2.2/gi/pygi-argument.c
--- pygobject-3.2.2/gi/pygi-argument.c.fix-argument-to-array 2012-08-13 14:04:12.042265495 -0400
+++ pygobject-3.2.2/gi/pygi-argument.c 2012-08-13 14:05:39.579171131 -0400
@@ -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)
@@ -706,6 +744,7 @@ check_number_release:
GArray *
_pygi_argument_to_array (GIArgument *arg,
GIArgument *args[],
+ GICallableInfo *callable_info,
GITypeInfo *type_info,
gboolean is_method)
{
@@ -732,12 +771,20 @@ _pygi_argument_to_array (GIArgument *ar
length = g_type_info_get_array_fixed_size (type_info);
if (length < 0) {
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 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 -up pygobject-3.2.2/gi/pygi-argument.h.fix-argument-to-array pygobject-3.2.2/gi/pygi-argument.h
--- pygobject-3.2.2/gi/pygi-argument.h.fix-argument-to-array 2012-08-13 14:04:12.000000000 -0400
+++ pygobject-3.2.2/gi/pygi-argument.h 2012-08-13 14:05:57.652945179 -0400
@@ -50,6 +50,7 @@ gint _pygi_g_registered_type_info_check_
GArray* _pygi_argument_to_array (GIArgument *arg,
GIArgument *args[],
+ GICallableInfo *callable_info,
GITypeInfo *type_info,
gboolean is_method);
diff -up pygobject-3.2.2/gi/pygi-closure.c.fix-argument-to-array pygobject-3.2.2/gi/pygi-closure.c
diff -up pygobject-3.2.2/gi/pygi-info.c.fix-argument-to-array pygobject-3.2.2/gi/pygi-info.c
--- pygobject-3.2.2/gi/pygi-info.c.fix-argument-to-array 2012-05-14 12:49:12.000000000 -0400
+++ pygobject-3.2.2/gi/pygi-info.c 2012-08-13 14:06:37.788443416 -0400
@@ -1236,7 +1236,7 @@ _wrap_g_field_info_get_value (PyGIBaseIn
if ( (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_ARRAY) &&
(g_type_info_get_array_type (field_type_info) == GI_ARRAY_TYPE_C)) {
- value.v_pointer = _pygi_argument_to_array (&value, NULL,
+ value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL,
field_type_info, FALSE);
}
diff -up pygobject-3.2.2/gi/pygi-signal-closure.c.fix-argument-to-array pygobject-3.2.2/gi/pygi-signal-closure.c

View File

@ -22,7 +22,7 @@
Name: pygobject3
Version: 3.2.2
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+ and MIT
Group: Development/Languages
Summary: Python 2 bindings for GObject Introspection
@ -59,6 +59,10 @@ Patch4: fix-list-marshalling-on-big-endian-machines.patch
# Not yet sent upstream:
Patch5: test-list-marshalling.patch
# Fix endianness issue in _pygi_argument_to_array (rhbz#841596;
# backport of attachment 603634):
Patch6: fix-argument-to-array.patch
### Build Dependencies ###
@ -133,6 +137,7 @@ for use in Python 3 programs.
%patch3 -p1 -b .endianness-fixes
%patch5 -p1 -b .test-list-marshalling
%patch6 -p1 -b .fix-argument-to-array
autoreconf
@ -186,6 +191,7 @@ find $RPM_BUILD_ROOT -name '*.a' -delete
# File "/builddir/build/BUILD/python3-pygobject3-3.3.4-4.fc19/gi/__init__.py", line 23, in <module>
# from ._gi import _API, Repository
#ValueError: level must be >= 0
# Reported upstream as http://bugs.python.org/issue15610
%if 0
pushd %{py3dir}
PYTHON=%{__python3}
@ -231,6 +237,9 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
%endif # with_python3
%changelog
* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-5
- add endianness patch (rhbz#841596; backport of attachment 603634)
* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-4
- update endianness patch for rhbz#841596 (to attachment 603367)