On Fri, Dec 14, 2012 at 7:27 AM, Gregory P. Smith <greg@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