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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ffc0060e-52dd-d894-54ee-b5f39d8d48e6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CBAC:284E5C:1E5567C:29AEDDC:696AB587 |
| html-safe-nonce | 18e59030887c655073b41262176afca8afed28949fabfa2390b1445d753772a4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkFDOjI4NEU1QzoxRTU1NjdDOjI5QUVEREM6Njk2QUI1ODciLCJ2aXNpdG9yX2lkIjoiNjcwNTUwMjczNzU3MjQ3NjI5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b2d76bcb2b663cf27b2efb43932ed8dd0de0415b0411fabc9a254b2409d76ad7 |
| hovercard-subject-tag | pull_request:774760309 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 | 4fa1799b6a53c2d30c950d74230781bef9e7f61138c72c7727e4b83f0743752b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 41f276818bd204c4a30a0281fb3c576298d9474c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width