You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
queue.SimpleQueue.__sizeof__() ignores the underlying data structure #140025
queue.SimpleQueue (C level) uses a list on Python < 3.13[1][2][3][4], a ring buffer on Python >= 3.13[5][6]. However, it does not implement its own __sizeof__() method, and as a result, only the size of the simplequeueobject structure itself (basicsize) is taken as the size of the object, while the size of the underlying structure is ignored.
>>>fromqueueimportSimpleQueue>>>q=SimpleQueue()
>>>q.__sizeof__()
72# 56 on Python < 3.13>>>for_inrange(1_000):
... q.put(object())
...
>>>q.__sizeof__()
72# 56 on Python < 3.13
Activity
pitrou commentedon Oct 14, 2025
I'm going to unassign myself as I'm not really active anymore.
pitrou commentedon Oct 14, 2025
cc @mpage
fix: pythongh-140025 queue.SimpleQueue.__sizeof__() ignores the under…
fix: pythongh-140025 queue.SimpleQueue.__sizeof__() ignores the under…
fix: pythongh-140025 queue.SimpleQueue.__sizeof__() ignores the under…
Fix queue.SimpleQueue.__sizeof__() to account for buffer
picnixz commentedon Dec 30, 2025
Removing the easy label because we already have a PR for that. For newcomers, don't create a PR if one already exists.
gh-140025: Fix `queue.SimpleQueue.__sizeof__()` to return correct size (
pythongh-140025: Fix `queue.SimpleQueue.__sizeof__()` to return corre…
pythongh-140025: Fix `queue.SimpleQueue.__sizeof__()` to return corre…