Title: Fix StringIO newline splitting and character positions by doma17 · Pull Request #8351 · RustPython/RustPython · GitHub
Open Graph Title: Fix StringIO newline splitting and character positions by doma17 · Pull Request #8351 · RustPython/RustPython
X Title: Fix StringIO newline splitting and character positions by doma17 · Pull Request #8351 · RustPython/RustPython
Description: Closes #4936 This PR follows our AI policy AI assistance: codex gpt-5.6-sol Summary Fix StringIO(newline='') so readline() recognizes CR, LF, and CRLF boundaries. Also use character-based positions and sizes for StringIO. This restores CR-separated email header parsing and prevents read(n) from splitting multibyte characters. Remove expected-failure markers from the inherited test_memoryio and test_email cases that now pass. Testing prek run --all-files cargo run --release -- -m test test_memoryio cargo run --release -- -m test test_email Compared the #4936 reproducer with CPython Summary by CodeRabbit Bug Fixes String-based streams now measure stream positions, lengths, reads, and truncation in characters (not UTF-8 bytes), with correct handling for multibyte text. write() now reports the number of characters written. readline()/line slicing now respect the stream’s newline behavior accurately. Restored stream state validates and reconstructs the cursor position and newline mode correctly. New Features Stream construction supports a configurable newline setting, which is preserved across save/restore.
Open Graph Description: Closes #4936 This PR follows our AI policy AI assistance: codex gpt-5.6-sol Summary Fix StringIO(newline='') so readline() recognizes CR, LF, and CRLF boundaries. Also use character-based...
X Description: Closes #4936 This PR follows our AI policy AI assistance: codex gpt-5.6-sol Summary Fix StringIO(newline='') so readline() recognizes CR, LF, and CRLF boundaries. Also use charact...
Opengraph URL: https://github.com/RustPython/RustPython/pull/8351
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2156ab4a-bc36-f013-a0bb-af316846584d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A8DE:100F73:211F99:2C615B:6A628E98 |
| html-safe-nonce | 6b177deb279128d8c07373916779b7b9a14c7a9305811a67171bdccdaaca6860 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOERFOjEwMEY3MzoyMTFGOTk6MkM2MTVCOjZBNjI4RTk4IiwidmlzaXRvcl9pZCI6Ijg2MjgyMzY5NDAzMzE4ODAwODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1d19fcf3f6bc5b07ffbfa4f463f911e3a2c888f1e5cbcc923e850db7821d8400 |
| hovercard-subject-tag | pull_request:4113238296 |
| 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/8351/files |
| twitter:image | https://avatars.githubusercontent.com/u/67214970?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/67214970?s=400&v=4 |
| og:image:alt | Closes #4936 This PR follows our AI policy AI assistance: codex gpt-5.6-sol Summary Fix StringIO(newline='') so readline() recognizes CR, LF, and CRLF boundaries. Also use character-based... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ac2209d8cb6970a1bd08cb0a3f821d7166ac544c2ca1c87819c335bb84310ecd |
| 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 | 2fca8cd598678aaa64706088ad13b4e19177e108 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width