Skip to content

Add object.__sizeof__#3728

Merged
youknowone merged 1 commit into
RustPython:mainfrom
rng-dynamics:object-sizeof
May 21, 2022
Merged

Add object.__sizeof__#3728
youknowone merged 1 commit into
RustPython:mainfrom
rng-dynamics:object-sizeof

Conversation

@rng-dynamics

@rng-dynamics rng-dynamics commented May 20, 2022

Copy link
Copy Markdown
Contributor

I had a look at object.__sizeof__. @moreal opened a pull request (#3421) on it last year, but it never got finished.

CPython uses tp_basicsize, tp_itemsize, and ob_size in __sizeof__. The intended use of tp_basicsize and tp_itemsize can be seen, e.g., at https://docs.python.org/3/extending/newtypes_tutorial.html#defining-new-types. Since new types are implemented different in RustPython we don't need tp_itemsize (and ob_size).

If merged, this should be the last point for #2898.

Can you give me some feedback? Thanks!

@youknowone

Copy link
Copy Markdown
Member

thank you! it looks great!

@youknowone youknowone merged commit bce9341 into RustPython:main May 21, 2022
@rng-dynamics rng-dynamics deleted the object-sizeof branch June 18, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants