
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2015-10-16 16:42 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| sizeof_dynamic.patch | serhiy.storchaka,2015-10-16 16:41 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg253074 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2015-10-16 16:41 | |
Default __sizeof__() implementation uses tp_basicsize. This makes it to work correctly with most builtin types and types with __slots__ (using __slots__ increases tp_basicsize). But special implementations of __sizeof__() use static object size ('sizeof(XXXObject)'), and return incorrect result for subclasses that increase tp_basicsize. Proposed patch makes __sizeof__() for all subclassable builtin type that support changing object size (i.e. tp_itemsize == 0) to use dynamic size _PyObject_SIZE(Py_TYPE(self)).Example (with patched code):>>> class D(dict):... __slots__ = 'a', 'b', 'c'... >>> sys.getsizeof({})144>>> sys.getsizeof(D())156In unpatched Python sys.getsizeof(D()) returns 144. | |||
| msg256734 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-12-19 18:08 | |
New changeset71d6755145ae by Serhiy Storchaka in branch '3.5':Issue#25421: __sizeof__ methods of builtin types now use dynamic basic size.https://hg.python.org/cpython/rev/71d6755145aeNew changeset4a47e998c40a by Serhiy Storchaka in branch 'default':Issue#25421: __sizeof__ methods of builtin types now use dynamic basic size.https://hg.python.org/cpython/rev/4a47e998c40aNew changesetbe3998aed1e7 by Serhiy Storchaka in branch '2.7':Issue#25421: __sizeof__ methods of builtin types now use dynamic basic size.https://hg.python.org/cpython/rev/be3998aed1e7 | |||
| msg256735 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2015-12-19 18:13 | |
Committed with improved tests. | |||
| msg256737 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2015-12-19 19:08 | |
At least some of the buildbots aren't happy.http://buildbot.python.org/all/builders/ARMv7%20Ubuntu%203.5/builds/479/steps/test/logs/stdiohttp://buildbot.python.org/all/builders/ARMv7%20Ubuntu%202.7/builds/1077/steps/test/logs/stdiohttp://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%202.7/builds/1098/steps/test/logs/stdio | |||
| msg256738 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-12-19 20:51 | |
New changeseta1388dbdd293 by Serhiy Storchaka in branch '3.5':Use correct PyGC_Head size in tests for issue#25421.https://hg.python.org/cpython/rev/a1388dbdd293New changesetab97ff838e11 by Serhiy Storchaka in branch '2.7':Use correct PyGC_Head size in tests for issue#25421.https://hg.python.org/cpython/rev/ab97ff838e11New changeset5115f39cc59f by Serhiy Storchaka in branch 'default':Use correct PyGC_Head size in tests for issue#25421.https://hg.python.org/cpython/rev/5115f39cc59f | |||
| msg256739 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2015-12-19 20:52 | |
Thank you David. Looks related to alignment. Hope this will help. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:22 | admin | set | github: 69607 |
| 2015-12-20 07:27:55 | serhiy.storchaka | set | status: open -> closed |
| 2015-12-19 20:52:33 | serhiy.storchaka | set | messages: +msg256739 |
| 2015-12-19 20:51:26 | python-dev | set | messages: +msg256738 |
| 2015-12-19 19:08:32 | r.david.murray | set | status: closed -> open nosy: +r.david.murray messages: +msg256737 |
| 2015-12-19 18:13:45 | serhiy.storchaka | set | status: open -> closed versions: - Python 3.4 messages: +msg256735 assignee:serhiy.storchaka resolution: fixed stage: patch review -> resolved |
| 2015-12-19 18:08:30 | python-dev | set | nosy: +python-dev messages: +msg256734 |
| 2015-10-17 03:20:04 | rhettinger | set | nosy: +pitrou |
| 2015-10-16 16:42:00 | serhiy.storchaka | create | |