Title: Accept bytes in Unicode name lookup by youknowdot · Pull Request #9585 · RustPython/RustPython · GitHub
Open Graph Title: Accept bytes in Unicode name lookup by youknowdot · Pull Request #9585 · RustPython/RustPython
X Title: Accept bytes in Unicode name lookup by youknowdot · Pull Request #9585 · RustPython/RustPython
Description: Summary Accept bytes names in unicodedata.lookup and ucd_3_2_0.lookup, as CPython's s# argument converter does. Encode string names as UTF-8 fallibly, producing UnicodeEncodeError for surrogates rather than KeyError. Match CPython 3.15's 256-byte name limit and failed-name formatting for embedded NULs and invalid UTF-8 bytes. Verification and scope Compared against CPython 3.15.0's Modules/unicodedata.c, generated Clinic wrapper, Python/getargs.c, and Unicode formatting implementation. Independently source-reviewed input conversion, both UCD views, error ordering and the staged logic. Normal commit hooks, rustfmt and git diff --check passed. No test files were edited. No local build, RustPython runtime tests, workspace tests, C-API tests, or clippy ran because the required coordinated native execution guard was unavailable. Hosted CI must validate the exact commit. Existing canonical tests do not directly cover these input cases. s# also accepts some less-common buffer exporters with no release callback; this change does not add those. Bytearray and memoryview remain rejected. Wrong-type diagnostic wording may differ from CPython. The independent Unicode name-matching and decomposition work in #9476 remains necessary; this PR changes only the wrapper. AI assistance: OpenAI Codex assisted with implementation and source review. Summary by CodeRabbit New Features Unicode name lookups now accept either UTF-8 strings or bytes. Bug Fixes Names longer than 256 bytes now return a clear “name too long” error. Failed lookups format error messages using the input up to the first NUL byte.
Open Graph Description: Summary Accept bytes names in unicodedata.lookup and ucd_3_2_0.lookup, as CPython's s# argument converter does. Encode string names as UTF-8 fallibly, producing UnicodeEncodeError for surrogat...
X Description: Summary Accept bytes names in unicodedata.lookup and ucd_3_2_0.lookup, as CPython's s# argument converter does. Encode string names as UTF-8 fallibly, producing UnicodeEncodeError for surr...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9585
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d25566a2-e120-6358-8986-7112557cb1c0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C80E:F7C4C:33659B4:44D0D57:6B02039A |
| html-safe-nonce | e3fc9ccf61da8c044c99b89973c27ea520e45db76de9c9a99e5cb154063dae14 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODBFOkY3QzRDOjMzNjU5QjQ6NDREMEQ1Nzo2QjAyMDM5QSIsInZpc2l0b3JfaWQiOiI2MzAzNjU2ODU3MTI2OTYyMDc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e4917ceaf2d0a021a8de935a3551328f1c1dcac660e4ddb1f2ab3716b3a5a72a |
| hovercard-subject-tag | pull_request:5136749615 |
| 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/9585/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Accept bytes names in unicodedata.lookup and ucd_3_2_0.lookup, as CPython's s# argument converter does. Encode string names as UTF-8 fallibly, producing UnicodeEncodeError for surrogat... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width