New submission from Peter Ingebretson:

PEP 412 shared keys are not created for subclasses in Python 3.3 and 3.4:

>>> import sys
>>> class A:
...     pass
... 
>>> class B(A):
...     pass
... 
>>> a, b = A(), B()
>>> sys.getsizeof(vars(a))
96
>>> sys.getsizeof(vars(b))
288

(Actual sizes depend on platform and configuration).

This patch allows subclasses to share keys:

>>> import sys
>>> class A:
...     pass
... 
>>> class B(A):
...     pass
... 
>>> a, b = A(), B()
>>> sys.getsizeof(vars(a))
96
>>> sys.getsizeof(vars(b))
96

----------
components: Interpreter Core
files: subclass-keys-pep-412.patch
keywords: patch
messages: 211302
nosy: pingebretson
priority: normal
severity: normal
status: open
title: Support key-sharing dictionaries in subclasses
type: resource usage
versions: Python 3.5
Added file: http://bugs.python.org/file34096/subclass-keys-pep-412.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20637>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to