-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object.__sizeof__(1) have different output between 3.9.10 and 3.12.2 #117195
Comments
In 3.11, size of -1000, -1, 0, 1. 1000 are 20, 20, 24, 28, 28. In 3.13, 64, 64, 28, 56 , 56. I am not sure if really a 'bug' rather than intentional, but the only mention of 'size of' in 3.12 What's New is that str object size decreased and no mention that size of ints doubled. I seem's like a regression in memory use. The changelog has several mentions of sizes decreasing and only mentions a stack size increase. |
|
It's ends up with an assertion error on debug build for me (current main branch): ./python
Python 3.13.0a5+ (heads/main:eebea7e515, Mar 24 2024, 21:43:31) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> object.__sizeof__(1)
python: ./Include/object.h:344: Py_SIZE: Assertion `ob->ob_type != &PyLong_Type' failed.
Aborted |
./python
Python 3.13.0a5+ (heads/main:9967b568ed, Mar 23 2024, 16:10:16) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> object.__sizeof__(1)
56 |
Is this a debug build? For the debug build, you should use |
Note that the result of The crash in debug mode is likely because PyLongObject is not a PyVarObject in 3.12 even though the type has I'm not familiar enough with the code in longobject.c and its evolution to know what's the best fix for 3.12. Long term it is probably better to unset |
Perhaps @markshannon is the right person for this discussion. |
The result of |
…GH-117220) (cherry picked from commit 406ffb5) Co-authored-by: Mark Shannon <mark@hotpy.org>
…GH-117220) (cherry picked from commit 406ffb5) Co-authored-by: Mark Shannon <mark@hotpy.org>
Bug report
Bug description:
on a Windows x64 machine
CPython versions tested on:
3.9, 3.12
Operating systems tested on:
Windows
Linked PRs
object.__sizeof__
#117220object.__sizeof__
(GH-117220) #119456object.__sizeof__
(GH-117220) #127605The text was updated successfully, but these errors were encountered: