Ticket #25391: packing.patch

File packing.patch, 1.2 KB (added by Vaush, 18 months ago)

Python2 patch

  • Include/objimpl.h

    Fix for over-aligned GC info
    Patch by Florian Weimer
    
    See: https://bugzilla.redhat.com/show_bug.cgi?id=1540316
    Upstream discussion: https://mail.python.org/pipermail/python-dev/2018-January/152000.html
    
    diff --git a/Include/objimpl.h b/Include/objimpl.h
    index 55e83eced6..aa906144dc 100644
    a b PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); 
    248248/* for source compatibility with 2.2 */
    249249#define _PyObject_GC_Del PyObject_GC_Del
    250250
     251/* Former over-aligned definition of PyGC_Head, used to compute the
     252   size of the padding for the new version below. */
     253union _gc_head;
     254union _gc_head_old {
     255    struct {
     256        union _gc_head *gc_next;
     257        union _gc_head *gc_prev;
     258        Py_ssize_t gc_refs;
     259    } gc;
     260    long double dummy;
     261};
     262
    251263/* GC information is stored BEFORE the object structure. */
    252264typedef union _gc_head {
    253265    struct {
    typedef union _gc_head { 
    255267        union _gc_head *gc_prev;
    256268        Py_ssize_t gc_refs;
    257269    } gc;
    258     long double dummy;  /* force worst-case alignment */
     270    double dummy;  /* force worst-case alignment */
     271    char dummy_padding[sizeof(union _gc_head_old)];
    259272} PyGC_Head;
    260273
    261274extern PyGC_Head *_PyGC_generation0;