Christian Heimes added the comment:

The code is missing an overflow check. There should be some verification that 
__sizeof__ returns a value smaller than SIZE_T_MAX - 24. Also 24 for GC 
overhead looks strange. IMHO it should be sizeof(PyGC_Head) which can be 
smaller than 24 bytes.

Python 3.5.0a0 (default:601045ceff94, Aug 14 2014, 22:59:49) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Overflow:
...     def __sizeof__(self):
...         return (1<<64)-1
... 
>>> sys.getsizeof(Overflow())
23

----------
nosy: +christian.heimes
stage: resolved -> needs patch
status: closed -> open

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

Reply via email to