From de45e32745826001354fbf408fc64ca5bf7c3541 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Thu, 10 May 2018 02:28:49 -0700 Subject: [PATCH 1/2] Correct struct packing in _tracemalloc.c --- Misc/ACKS | 1 + Modules/_tracemalloc.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS index 587bbecbc36a3a..f0521c571d033e 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1505,6 +1505,7 @@ Václav Šmilauer Allen W. Smith Christopher Smith Eric V. Smith +Ethan Smith Gregory P. Smith Mark Smith Nathaniel J. Smith diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index e07022cce2bc9c..b3ee5f3047fc53 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -67,7 +67,10 @@ static PyThread_type_lock tables_lock; #define DEFAULT_DOMAIN 0 -/* Pack the frame_t structure to reduce the memory footprint. */ +/* Pack the pointer_t structure to reduce the memory footprint. */ +#if defined(_MSC_VER) +#pragma pack(push, 4) +#endif typedef struct #ifdef __GNUC__ __attribute__((packed)) @@ -76,14 +79,18 @@ __attribute__((packed)) uintptr_t ptr; unsigned int domain; } pointer_t; +#ifdef _MSC_VER +#pragma pack(pop) +#endif /* Pack the frame_t structure to reduce the memory footprint on 64-bit architectures: 12 bytes instead of 16. */ +#if defined(_MSC_VER) +#pragma pack(push, 4) +#endif typedef struct #ifdef __GNUC__ __attribute__((packed)) -#elif defined(_MSC_VER) -#pragma pack(push, 4) #endif { /* filename cannot be NULL: "" is used if the Python frame From 50220c86f4532030a0cd2f81d785723774d7b211 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 16 May 2018 15:37:04 -0400 Subject: [PATCH 2/2] Add NEWS file --- .../next/Build/2018-05-16-15-34-16.bpo-33351.8c-SEp.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2018-05-16-15-34-16.bpo-33351.8c-SEp.rst diff --git a/Misc/NEWS.d/next/Build/2018-05-16-15-34-16.bpo-33351.8c-SEp.rst b/Misc/NEWS.d/next/Build/2018-05-16-15-34-16.bpo-33351.8c-SEp.rst new file mode 100644 index 00000000000000..c574d0aab4610c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-05-16-15-34-16.bpo-33351.8c-SEp.rst @@ -0,0 +1,4 @@ +Add struct packing for pointer_t and fix struct packing under clang-cl for +frame_t. + +Patch by Ethan Smith