Repository navigation
Commit 9062f02
authored
Fix StringIO newline splitting and character positions (#8351)
* Keep StringIO text operations CPython-compatible
Constraint: email.feedparser depends on StringIO(newline='') recognizing CR, LF, and CRLF boundaries.
Rejected: an email-specific parser workaround | StringIO is the shared root cause.
Confidence: high
Scope-risk: moderate
Directive: Keep internal storage byte-based; convert only at StringIO API boundaries.
Tested: prek run --all-files; test_memoryio; test_email; full workspace verification by contributor
Assisted-by: Codex:gpt-5.6-sol
* Run restored StringIO conformance tests
Constraint: upstream StringIO tests already cover the repaired behavior.
Rejected: new RustPython-only regression tests | existing CPython coverage is sufficient.
Confidence: high
Scope-risk: narrow
Directive: Remove expected-failure markers only while the inherited tests pass.
Tested: prek run --all-files; test_memoryio; test_email
Assisted-by: Codex:gpt-5.6-sol
* Keep StringIO newline handling consistent
Constraint: StringIO must apply its newline mode consistently when constructing, writing, and reading text.\nRejected: a readline-only fix | it leaves CR and CRLF modes internally inconsistent.\nConfidence: high\nScope-risk: moderate\nDirective: Keep StringIO buffer contents valid WTF-8 before using unchecked views.\nTested: prek run --all-files; cargo clippy -p rustpython-vm -- -D warnings; test_memoryio; test_shlex; test_email; workspace excluding rustpython-capi; full workspace manually verified by contributor\nNot-tested: local rustpython-capi workspace test crashes with a pre-existing macOS SIGSEGV\nAssisted-by: Codex:gpt-5.6-sol1 parent c6b80e8 commit 9062f02
4 files changed
Lines changed: 121 additions & 88 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3812 | 3812 | | |
3813 | 3813 | | |
3814 | 3814 | | |
3815 | | - | |
3816 | 3815 | | |
3817 | 3816 | | |
3818 | 3817 | | |
| |||
3843 | 3842 | | |
3844 | 3843 | | |
3845 | 3844 | | |
3846 | | - | |
3847 | 3845 | | |
3848 | 3846 | | |
3849 | 3847 | | |
| |||
3877 | 3875 | | |
3878 | 3876 | | |
3879 | 3877 | | |
3880 | | - | |
3881 | 3878 | | |
3882 | 3879 | | |
3883 | 3880 | | |
| |||
3896 | 3893 | | |
3897 | 3894 | | |
3898 | 3895 | | |
3899 | | - | |
3900 | 3896 | | |
3901 | 3897 | | |
3902 | 3898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
943 | | - | |
944 | 943 | | |
945 | 944 | | |
946 | 945 | | |
| |||
965 | 964 | | |
966 | 965 | | |
967 | 966 | | |
968 | | - | |
969 | 967 | | |
970 | 968 | | |
971 | 969 | | |
| |||
1002 | 1000 | | |
1003 | 1001 | | |
1004 | 1002 | | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | 1003 | | |
1022 | 1004 | | |
1023 | 1005 | | |
| |||
1026 | 1008 | | |
1027 | 1009 | | |
1028 | 1010 | | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | 1011 | | |
1039 | 1012 | | |
1040 | 1013 | | |
| |||
1044 | 1017 | | |
1045 | 1018 | | |
1046 | 1019 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | 1020 | | |
1064 | 1021 | | |
1065 | 1022 | | |
1066 | 1023 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | 1024 | | |
1077 | 1025 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | 173 | | |
175 | | - | |
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
| |||
313 | 311 | | |
314 | 312 | | |
315 | 313 | | |
316 | | - | |
317 | 314 | | |
318 | 315 | | |
319 | 316 | | |
| |||
356 | 353 | | |
357 | 354 | | |
358 | 355 | | |
359 | | - | |
360 | 356 | | |
361 | 357 | | |
362 | 358 | | |
| |||
0 commit comments