Title: Add 'w' (Py_UCS4) typecode support to array by HyoJongPark · Pull Request #8266 · RustPython/RustPython · GitHub
Open Graph Title: Add 'w' (Py_UCS4) typecode support to array by HyoJongPark · Pull Request #8266 · RustPython/RustPython
X Title: Add 'w' (Py_UCS4) typecode support to array by HyoJongPark · Pull Request #8266 · RustPython/RustPython
Description: This PR follows our AI policy Summary This PR implements support for the 'w' typecode (Py_UCS4, added in Python 3.13) in the array module. Changes Add a Ucs4Char(u32) element type The key difference from the existing 'u' typecode is that elements must be allocated a fixed 4 bytes, rather than a platform-dependent size. u32 is used for this, just as CPython uses uint32_t (Py_UCS4). Extend the existing 'u'-only branches to 'u' | 'w' This covers the str constructor, fromunicode()/tounicode(), __reduce_ex__, and repr. The internal conversion helpers (_unicode_to_wchar_bytes, etc.) operate on itemsize and are reused without modification. Add 'w' to the machine format code used for pickling 'u' maps to UTF16 or UTF32 depending on the size of wchar_t, while 'w' is always fixed to UTF32. Register 'w' in the format parser (FormatType) in vm/src/buffer.rs array passes its typecode character through as the buffer descriptor's format string, so the VM's format parser must also recognize 'w'; otherwise memoryview(array('w', ...)) fails to construct. Remove the 'w'-related expectedFailure markers in test_array.py Testing cargo run --release -- -m test test_array Summary by CodeRabbit New Features Added support for the array typecode 'w' for Unicode characters using UTF-32 (UCS-4). Enabled Unicode initialization, conversion, serialization, and display for 'w' arrays. Added buffer packing/unpacking support for the UCS-4 format, with native-endian handling restricted appropriately. Bug Fixes Improved typecode compatibility checks and error handling for Unicode transformations involving 'w' arrays.
Open Graph Description: This PR follows our AI policy Summary This PR implements support for the 'w' typecode (Py_UCS4, added in Python 3.13) in the array module. Changes Add a Ucs4Char(u32) element type The ke...
X Description: This PR follows our AI policy Summary This PR implements support for the 'w' typecode (Py_UCS4, added in Python 3.13) in the array module. Changes Add a Ucs4Char(u32) element type...
Opengraph URL: https://github.com/RustPython/RustPython/pull/8266
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:7b004acd-7833-f40a-8184-fae3a44fcef8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B2E8:102E1B:B34B42:10135E2:6A58CE2C |
| html-safe-nonce | cb6adaa50b3947b4ea45e04939379630480490c05129281ff990e1a4904ce121 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkU4OjEwMkUxQjpCMzRCNDI6MTAxMzVFMjo2QTU4Q0UyQyIsInZpc2l0b3JfaWQiOiI1NDgwMzU1MDMxNDEyMTY2MTg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8fb28be0e581ab340a4a0b34fe803490afdd9cf321ea39674e159a91e9d6e28d |
| hovercard-subject-tag | pull_request:4043742007 |
| 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/8266/files |
| twitter:image | https://avatars.githubusercontent.com/u/75190035?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/75190035?s=400&v=4 |
| og:image:alt | This PR follows our AI policy Summary This PR implements support for the 'w' typecode (Py_UCS4, added in Python 3.13) in the array module. Changes Add a Ucs4Char(u32) element type The ke... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| 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 | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width