Title: fix: Swapcase must handle multibyte expansions by joshuamegnauth54 · Pull Request #7559 · RustPython/RustPython · GitHub
Open Graph Title: fix: Swapcase must handle multibyte expansions by joshuamegnauth54 · Pull Request #7559 · RustPython/RustPython
X Title: fix: Swapcase must handle multibyte expansions by joshuamegnauth54 · Pull Request #7559 · RustPython/RustPython
Description: swapcase used to_ascii_lowercase and uppercase to swap cases. This is fine for ASCII, but code points may expand into multiple bytes which leads to incorrect case swaps for some languages. The fix is to use to_lowercase directly. Unfortunately, this leads to a realloc in swapcase when bytes are expanded. Part of #7526. Most of the disabled swapcase tests seem to pass now including the new assert based on #7526. However, there are other areas where to_ascii_lowercase and to_ascii_uppercase are used which seem to be causing the other cases to fail. Summary by CodeRabbit Bug Fixes swapcase now correctly applies full Unicode case mappings, including characters that map to multiple code points. Tests Added a test validating Unicode swapcase behavior for non-ASCII text.
Open Graph Description: swapcase used to_ascii_lowercase and uppercase to swap cases. This is fine for ASCII, but code points may expand into multiple bytes which leads to incorrect case swaps for some languages. The fix ...
X Description: swapcase used to_ascii_lowercase and uppercase to swap cases. This is fine for ASCII, but code points may expand into multiple bytes which leads to incorrect case swaps for some languages. The fix ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/7559
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:75f40da7-c9a3-bb16-2043-5d50cabf0954 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8DD6:36BC1A:A19BF:DD6C4:6A610D36 |
| html-safe-nonce | 0fefab488387de79a95b8bf6737200d114e7b529e8625dca693e9892c5c5dd71 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REQ2OjM2QkMxQTpBMTlCRjpERDZDNDo2QTYxMEQzNiIsInZpc2l0b3JfaWQiOiI0MjgxNDg2MjMyOTYxMjIzOTkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ed263afabaa73858699bbeec66ea94ea5f01fc90bde2585af99a7944f90da05f |
| hovercard-subject-tag | pull_request:3488250008 |
| 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/7559/files |
| twitter:image | https://avatars.githubusercontent.com/u/48846352?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/48846352?s=400&v=4 |
| og:image:alt | swapcase used to_ascii_lowercase and uppercase to swap cases. This is fine for ASCII, but code points may expand into multiple bytes which leads to incorrect case swaps for some languages. The fix ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 86be97fd69ac233b46e43a5eed04ceac6498abe1efaf1af3b9573eb216019c05 |
| 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 | f80280886562a52fe1f6b9cab9f9c1dc3b9a78a2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width