[pypy-commit] cffi cffi-1.0: Fix for test_verify
arigo
noreply at buildbot.pypy.org
Fri Apr 24 10:12:44 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1785:548efd04854c
Date: 2015-04-24 09:23 +0200
http://bitbucket.org/cffi/cffi/changeset/548efd04854c/
Log: Fix for test_verify
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -3802,7 +3802,7 @@
CTypeDescrObject *ct;
PyObject *fields, *interned_fields, *ignored;
int is_union, alignment;
- Py_ssize_t boffset, i, nb_fields, boffsetmax;
+ Py_ssize_t boffset, i, nb_fields, boffsetmax, alignedsize;
Py_ssize_t totalsize = -1;
int totalalignment = -1;
CFieldObject **previous;
@@ -4084,12 +4084,15 @@
as 1 instead. But for ctypes support, we allow the manually-
specified totalsize to be zero in this case. */
boffsetmax = (boffsetmax + 7) / 8; /* bits -> bytes */
- boffsetmax = (boffsetmax + alignment - 1) & ~(alignment-1);
+ alignedsize = (boffsetmax + alignment - 1) & ~(alignment-1);
+ if (alignedsize == 0)
+ alignedsize = 1;
+
if (totalsize < 0) {
- totalsize = boffsetmax ? boffsetmax : 1;
+ totalsize = alignedsize;
}
else {
- if (detect_custom_layout(ct, sflags, boffsetmax ? boffsetmax : 1,
+ if (detect_custom_layout(ct, sflags, alignedsize,
totalsize, "wrong total size", "", "") < 0)
goto error;
if (totalsize < boffsetmax) {
More information about the pypy-commit
mailing list