Title: Correct __sizeof__ support for StgDict
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: aliles, amaury.forgeotdarc, belopolsky, jcea, meador.inge, serhiy.storchaka
Priority: low Keywords: patch

Created on 2012-08-16 19:13 by serhiy.storchaka, last changed 2017-03-24 22:24 by serhiy.storchaka. This issue is now closed.

File name Uploaded Description Edit
stgdict_sizeof-3.3.patch serhiy.storchaka, 2012-08-16 19:13 Patch for 3.3 review
stgdict_sizeof-3.2.patch serhiy.storchaka, 2012-08-16 19:14 Patch for 3.2 review
stgdict_sizeof-2.7.patch serhiy.storchaka, 2012-08-16 19:15 Patch for 2.7 review
Pull Requests
URL Status Linked Edit
PR 509 merged serhiy.storchaka, 2017-03-06 10:44
PR 639 merged serhiy.storchaka, 2017-03-12 11:36
Messages (6)
msg168399 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-08-16 19:13
Here is a patch that implements correct __sizeof__ for StgDict (a dictionary subclass used in ctypes).

There are no tests because I don't know how to create and use StgDict. So I'm not sure that the code works correctly. Please help me with tests.
msg170155 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012-09-10 02:56
What is the point of providing a __sizeof__ method to a purely internal type?  I don't think it is possible to expose StgDict at the python level.  It is always hidden behind a mapping proxy.  Furthemore, StgDict is only used inside type objects and the size of type objects is not relevant for __sizeof__ calculations.
msg170563 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-09-16 18:32
I don't know where StgDict used. Probably need to provide the correct __sizeof__ method for a mapping proxy behind which StgDict hidden.
msg289091 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-06 10:46
Now changes are simpler since _PyDict_SizeOf() already was implemented.
msg290198 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-24 22:22
New changeset bc44f045e6a801903bd7530a4fc5474e657832da by Serhiy Storchaka in branch 'master':
bpo-15695: Add PyAPI_FUNC() to _PyDict_SizeOf() declaration. (#639)
msg290212 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-24 22:24
New changeset 8999caeb003ed292011e98b8a30746cce787a125 by Serhiy Storchaka in branch 'master':
bpo-15695: Implemented StgDict.__sizeof__(). (#509)
Date User Action Args
2017-03-24 22:24:41serhiy.storchakasetmessages: + msg290212
2017-03-24 22:22:25serhiy.storchakasetmessages: + msg290198
2017-03-12 12:18:22serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: test needed -> resolved
2017-03-12 11:36:59serhiy.storchakasetpull_requests: + pull_request528
2017-03-06 10:46:27serhiy.storchakasetpriority: normal -> low

messages: + msg289091
2017-03-06 10:44:19serhiy.storchakasetpull_requests: + pull_request418
2017-03-06 10:25:09serhiy.storchakasetversions: + Python 3.7, - Python 2.7, Python 3.2, Python 3.3
2013-01-07 16:28:10serhiy.storchakasetassignee: serhiy.storchaka
2012-09-16 18:32:31serhiy.storchakasetmessages: + msg170563
2012-09-10 02:56:43belopolskysetmessages: + msg170155
2012-09-10 02:33:13jceasetnosy: + jcea
2012-08-29 12:02:45alilessetnosy: + aliles
2012-08-16 19:15:07serhiy.storchakasetfiles: + stgdict_sizeof-2.7.patch
stage: patch review -> test needed
2012-08-16 19:14:08serhiy.storchakasetfiles: + stgdict_sizeof-3.2.patch
2012-08-16 19:13:36serhiy.storchakacreate