diff -r e38d975da53e Modules/_tracemalloc.c --- a/Modules/_tracemalloc.c Wed Nov 20 22:01:42 2013 +0100 +++ b/Modules/_tracemalloc.c Wed Nov 20 22:49:53 2013 +0100 @@ -71,7 +71,12 @@ static PyThread_type_lock tables_lock; # define TABLES_UNLOCK() #endif -typedef struct { +#pragma pack(4) +typedef struct +#ifdef __GNUC__ +__attribute__((packed)) +#endif +{ PyObject *filename; int lineno; } frame_t; @@ -657,6 +662,9 @@ tracemalloc_init(void) if (tracemalloc_config.initialized == TRACEMALLOC_INITIALIZED) return 0; + /* ensure that the frame_t structure is packed */ + assert(sizeof(frame_t) == (sizeof(PyObject*) + sizeof(int))); + PyMem_GetAllocator(PYMEM_DOMAIN_RAW, &allocators.raw); #ifdef REENTRANT_THREADLOCAL