Title: Implement `object.__sizeof__` by moreal · Pull Request #3421 · RustPython/RustPython · GitHub
Open Graph Title: Implement `object.__sizeof__` by moreal · Pull Request #3421 · RustPython/RustPython
X Title: Implement `object.__sizeof__` by moreal · Pull Request #3421 · RustPython/RustPython
Description: This pull request may close #356. This pull request implements object.__sizeof__ fully, except for setting all types' ob_size. It introduces PyVarObject.ob_size field and tp_itemsize slot. Also it provides a way to setup itemsize slot with pyclass macro. ob_size field is used to calculate variable object's size with itemsize (ob_size * itemsize + basicsize). Because this pull request modified the core part like (PyInner and PyObjectRef) and I felt the next work can be more bigger, I cut this part and request a review for this pull request. Related codes: CPython object.__sizeof__ impl: https://github.com/python/cpython/blob/e5d8dbdd304935dbd0631ee9605efb501332f792/Objects/typeobject.c#L5520-L5533 CPython PyVarObject: https://github.com/python/cpython/blob/fa2b8b75eb2b8a0193d587e02b488a73579118fc/Include/object.h#L111-L114 The next work will be to call set_ob_size.
Open Graph Description: This pull request may close #356. This pull request implements object.__sizeof__ fully, except for setting all types' ob_size. It introduces PyVarObject.ob_size field and tp_itemsize slot. Also...
X Description: This pull request may close #356. This pull request implements object.__sizeof__ fully, except for setting all types' ob_size. It introduces PyVarObject.ob_size field and tp_itemsize slot. ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/3421
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:588efe01-82d5-1acb-7e4e-993e82068d73 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | D4A8:37CCD2:10F6FE6:16D5A0A:696AD231 |
| html-safe-nonce | f5c10765947c2ecc8cc76ffaa944e6ef46fe7724e23040f30e45bb5a60a11241 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEE4OjM3Q0NEMjoxMEY2RkU2OjE2RDVBMEE6Njk2QUQyMzEiLCJ2aXNpdG9yX2lkIjoiMjEyMjQ2Nzk2MDY0NTQwNzI4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8592d4984719ca5d9e1c16dc9beeb8f12e878a08f52ed2f7a385076fe80fb3c8 |
| hovercard-subject-tag | pull_request:774760309 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/3421/checks |
| twitter:image | https://avatars.githubusercontent.com/u/26626194?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/26626194?s=400&v=4 |
| og:image:alt | This pull request may close #356. This pull request implements object.__sizeof__ fully, except for setting all types' ob_size. It introduces PyVarObject.ob_size field and tp_itemsize slot. Also... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width