Title: csv: fix csv escape fieldsep by widehyo1 · Pull Request #8260 · RustPython/RustPython · GitHub
Open Graph Title: csv: fix csv escape fieldsep by widehyo1 · Pull Request #8260 · RustPython/RustPython
X Title: csv: fix csv escape fieldsep by widehyo1 · Pull Request #8260 · RustPython/RustPython
Description: This PR follows our AI policy. Summary csv.reader did not pass a dialect's escapechar into csv_core, so an escape character worked only when supplied as an explicit keyword argument. The first commit passes the dialect value through to csv_core, fixing escaped delimiters inside quoted fields. csv_core does not apply its escape setting to unquoted fields. The second commit adds a small RustPython QUOTE_NONE parser path: an escape character makes the following byte data, so an escaped delimiter does not split a field. import csv class EscapedExcel(csv.excel): quoting = csv.QUOTE_NONE escapechar = "\\" list(csv.reader(["abc\\,def\\r\\n"], dialect=EscapedExcel())) # before: [["abc\\", "def"]] # after: [["abc,def"]] # matches CPython Summary by CodeRabbit Bug Fixes Improved CSV parsing for dialects and defaults with custom escapechar, ensuring consistent behavior across dialect resolution paths. Enhanced QUOTE_NONE handling with escapechar and skipinitialspace, including correct escaped separators and whitespace processing. Added stricter input validation (record termination, field size limits, and UTF-8 decoding) and ensured trailing escapes are handled gracefully. Tests Added a regression test for QUOTE_NONE with escapechar and skipinitialspace to verify correct field parsing.
Open Graph Description: This PR follows our AI policy. Summary csv.reader did not pass a dialect's escapechar into csv_core, so an escape character worked only when supplied as an explicit keyword argument. The first...
X Description: This PR follows our AI policy. Summary csv.reader did not pass a dialect's escapechar into csv_core, so an escape character worked only when supplied as an explicit keyword argument. The f...
Opengraph URL: https://github.com/RustPython/RustPython/pull/8260
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c87d5507-43f5-2461-f877-e1d3ec26e352 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A406:3FF3CA:3933F0B:4F33EE3:6A60E6E4 |
| html-safe-nonce | 7ee49e1241a0039484e9f64c214334d16f37fd4e55045a7f4c5e40f0dfdc342f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDA2OjNGRjNDQTozOTMzRjBCOjRGMzNFRTM6NkE2MEU2RTQiLCJ2aXNpdG9yX2lkIjoiODYzMTI2NjY3MDM5MTkxMjE2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3393a767db48c7130d16978fe2dbfd1bfc371ffeeef538c08adc06af2f5fde2c |
| hovercard-subject-tag | pull_request:4038640015 |
| 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/8260/files |
| twitter:image | https://avatars.githubusercontent.com/u/87641474?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/87641474?s=400&v=4 |
| og:image:alt | This PR follows our AI policy. Summary csv.reader did not pass a dialect's escapechar into csv_core, so an escape character worked only when supplied as an explicit keyword argument. The first... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1957f194e271fe30a03dc862496c17190cace7b76c3327faf05645d99ab7da7b |
| 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 | ce4ea0e3ce641f8f789b539253752038d78f1cfe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width