[issue33589] Remove dummy member in GCHead

Antoine Pitrou report at bugs.python.org
Mon May 21 06:04:59 EDT 2018


Antoine Pitrou <pitrou at free.fr> added the comment:

>From the linked changeset message:

> unless anyone knows of a platform where ssize_t is 4 bytes?

That's most 32-bit platforms, right?  Basically, size_t and ssize_t are pointer-sized except on some rare architectures.

> A more correct non-hacky alternative if any alignment issues are still found would be to use a compiler specific alignment declaration on the structure and determine which value to use at configure time.

AFAIU, the problem is not alignment of the PyGC_Head structure (it's always sufficiently aligned for its pointer-sized members) but alignment of the user-defined object that follows it.

The underlying issue IMO is we're trying to force a one-size-fits-all alignment for user-defined object structs that we know nothing about (but might contain something like a "long double" or, worse, some SIMD values).  Perhaps PyTypeObject should grow a `tp_alignment` field.

----------
nosy: +gregory.p.smith, serhiy.storchaka, tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33589>
_______________________________________


More information about the Python-bugs-list mailing list