Title: Use PyStrRef for TypeAliasType name by walker84837 · Pull Request #6203 · RustPython/RustPython · GitHub
Open Graph Title: Use PyStrRef for TypeAliasType name by walker84837 · Pull Request #6203 · RustPython/RustPython
X Title: Use PyStrRef for TypeAliasType name by walker84837 · Pull Request #6203 · RustPython/RustPython
Description: This MR changes TypeAliasType so that it uses a PyStrRef object for its name field instead of a PyObjectRef. Previously, the name field was a PyObjectRef. Although PyObjectRef is flexible, using a more specific type, like PyStrRef, improves transparency and type safety. Changes include: As mentioned, updating TypeAliasType.name from PyObjectRef to PyStrRef. Changing TypeAliasType::new() and __name__ getter to handle PyStrRef. Adding small type checks in: vm/src/frame.rs vm/src/stdlib/typing.rs to enforce that the TypeAliasType name is a string. Since the type of name is now a PyStrRef, the repr_str implementation for TypeAliasType was simplified by using PyStrRef::as_str() directly. Summary by CodeRabbit Bug Fixes Strengthened validation for TypeAliasType names so non-string names now produce a clear "TypeAliasType name must be a string" error. Improved consistency of TypeAliasType construction and string representation, reducing confusion when inspecting or creating type aliases.
Open Graph Description: This MR changes TypeAliasType so that it uses a PyStrRef object for its name field instead of a PyObjectRef. Previously, the name field was a PyObjectRef. Although PyObjectRef is flexible, using a ...
X Description: This MR changes TypeAliasType so that it uses a PyStrRef object for its name field instead of a PyObjectRef. Previously, the name field was a PyObjectRef. Although PyObjectRef is flexible, using a ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/6203
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:abb49b6a-0e98-2487-6e55-fdbe5ba3b686 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BD5C:9F1EC:1AD2C8D:259C8CC:696A4F99 |
| html-safe-nonce | 8c5cdd709d16ede29c5d275c9ee5c41c69d0cfc3497f549ace4fc7ebe87cb070 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDVDOjlGMUVDOjFBRDJDOEQ6MjU5QzhDQzo2OTZBNEY5OSIsInZpc2l0b3JfaWQiOiIzNTk3OTA3MTc4MjQ1NTI4NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b5047670417480ae730eadc86a3aa381f012158e8b2a1706685daf069aa16a50 |
| hovercard-subject-tag | pull_request:2931543256 |
| 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/6203/files |
| twitter:image | https://avatars.githubusercontent.com/u/68739688?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/68739688?s=400&v=4 |
| og:image:alt | This MR changes TypeAliasType so that it uses a PyStrRef object for its name field instead of a PyObjectRef. Previously, the name field was a PyObjectRef. Although PyObjectRef is flexible, using a ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| 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 | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width