Commit b800a690 authored by Martin Pitt's avatar Martin Pitt
Browse files

Fix marshalling of GByteArrays

In _pygi_marshal_from_py_array(), set the array length after copying the data
in the GI_TYPE_TAG_UINT8 case (which applies for GByteArrays), otherwise it
will always come out as zero length.

Enable the TestGByteArray.test_bytearray_none_in() test case as that works now.
parent fa568949
......@@ -930,6 +930,7 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8 &&
PYGLIB_PyBytes_Check (py_arg)) {
memcpy(array_->data, PYGLIB_PyBytes_AsString (py_arg), length);
array_->len = length;
if (sequence_cache->is_zero_terminated) {
/* If array_ has been created with zero_termination, space for the
* terminator is properly allocated, so we're not off-by-one here. */
......
......@@ -1022,8 +1022,7 @@ class TestGByteArray(unittest.TestCase):
def test_bytearray_full_return(self):
self.assertEqual(b'\x001\xFF3', GIMarshallingTests.bytearray_full_return())
# FIXME: we do not currently support marshalling GByteArrays
def disabled_test_bytearray_none_in(self):
def test_bytearray_none_in(self):
GIMarshallingTests.bytearray_none_in(b'\x00\x31\xFF\x33')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment