Author: Andrew Leech <[email protected]>
Branch: new_struct_allocated_size
Changeset: r2787:7e2189722b1d
Date: 2016-09-12 14:45 +1000
http://bitbucket.org/cffi/cffi/changeset/7e2189722b1d/
Log: When getting ffi.buffer() on CDataObject_own_structptr, use length
field for buffer size
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -5814,7 +5814,11 @@
&CData_Type, &cd, &size))
return NULL;
- if (cd->c_type->ct_flags & CT_POINTER) {
+ if (cd->c_type->ct_flags & CT_IS_PTR_TO_OWNED) {
+ if (size < 0)
+ size = ((CDataObject_own_structptr *)cd)->length;
+ }
+ else if (cd->c_type->ct_flags & CT_POINTER) {
if (size < 0)
size = cd->c_type->ct_itemdescr->ct_size;
}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit