This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Correct __sizeof__ support for BytesIO
Type: behavior Stage: resolved
Components: IO, Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, hynek, jcea, pitrou, python-dev, serhiy.storchaka, stutzbach
Priority: normal Keywords: patch

Created on 2012-07-29 19:48 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bytesio_sizeof-3.3.patch serhiy.storchaka, 2012-07-29 19:48 Patch for 3.3 review
bytesio_sizeof-3.2.patch serhiy.storchaka, 2012-07-29 19:48 Patch for 3.2 review
bytesio_sizeof-2.7.patch serhiy.storchaka, 2012-07-29 19:48 Patch for 2.7 review
Messages (6)
msg166806 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-07-29 19:48
Here is a patch that implements correct __sizeof__ for C implementation of io.BytesIO.
msg166818 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-29 22:07
New changeset 1d3155750808 by Antoine Pitrou in branch '3.2':
Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
http://hg.python.org/cpython/rev/1d3155750808

New changeset 917295aaad76 by Antoine Pitrou in branch 'default':
Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
http://hg.python.org/cpython/rev/917295aaad76

New changeset e8851809ae83 by Antoine Pitrou in branch '2.7':
Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
http://hg.python.org/cpython/rev/e8851809ae83
msg166819 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-29 22:07
Thank you!
msg166860 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-07-30 07:12
Antoine, it looks like you committed the wrong patch for 3.3. Patches for 3.2 and 3.3 are different, otherwise I would have provided a one patch.

-        basesize = support.calcobjsize('P2PP2PP')
+        basesize = support.calcobjsize('P2nN2Pn')
msg166886 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-30 11:59
Ah, but the BytesIO structure is the same in 3.2 and 3.3. Ok, that's because struct now has support for size_t and Py_ssize_t, I see.
msg166887 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-30 12:01
New changeset e77c117ab024 by Antoine Pitrou in branch 'default':
Better test for BytesIO.__sizeof__, now that the struct module supports (s)size_t.
http://hg.python.org/cpython/rev/e77c117ab024
History
Date User Action Args
2022-04-11 14:57:33adminsetgithub: 59694
2012-08-01 00:52:19jceasetnosy: + jcea
2012-07-30 12:01:12python-devsetmessages: + msg166887
2012-07-30 11:59:28pitrousetmessages: + msg166886
2012-07-30 07:12:56serhiy.storchakasetmessages: + msg166860
2012-07-29 22:07:42pitrousetstatus: open -> closed
resolution: fixed
messages: + msg166819

stage: resolved
2012-07-29 22:07:12python-devsetnosy: + python-dev
messages: + msg166818
2012-07-29 19:48:56serhiy.storchakasetfiles: + bytesio_sizeof-2.7.patch
2012-07-29 19:48:37serhiy.storchakasetfiles: + bytesio_sizeof-3.2.patch
2012-07-29 19:48:06serhiy.storchakacreate