[Python-Dev] cpython: Using 'long double' to force this structure to be worst case aligned is no (original) (raw)

Mark Dickinson dickinsm at gmail.com
Fri Dec 14 09:42:44 CET 2012


On Fri, Dec 14, 2012 at 7:27 AM, Gregory P. Smith <greg at krypto.org> wrote:

So changing the definition of the dummy side of the union makes zero difference to already compiled code as it (a) doesn't change the structure's size and (b) all existing implementations already align these on an 8 byte boundary.

It looks to me as though the struct size is changed, at least on some platforms. Before this commit, I get (OS X 10.6, 64-bit non-debug build):

Python 3.4.0a0 (default:b4c383f31881+, Dec 14 2012, 08:30:39) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information.

class A(object): pass ... a = A() import sys sys.getsizeof(a) 64

After it:

Python 3.4.0a0 (default:76bc92fb90c1+, Dec 14 2012, 08:33:48) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information.

class A(object): pass ... a = A() import sys sys.getsizeof(a) 56

-- Mark



More information about the Python-Dev mailing list