gh-113785: csv: fields starting with escapechar are not quoted#122110
Merged
serhiy-storchaka merged 4 commits intopython:mainfrom Jul 25, 2024
Merged
gh-113785: csv: fields starting with escapechar are not quoted#122110serhiy-storchaka merged 4 commits intopython:mainfrom
serhiy-storchaka merged 4 commits intopython:mainfrom
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
| @@ -0,0 +1 @@ | |||
| :mod:`csv` now correctly parses numeric fields (when used with :const:`csv.QUOTE_NONNUMERIC`) which start with an escape character. | |||
Member
There was a problem hiding this comment.
or csv.QUOTE_STRINGS.
|
Thanks @MKuranowski for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 25, 2024
…ythonGH-122110) (cherry picked from commit a3327db) Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 25, 2024
…ythonGH-122110) (cherry picked from commit a3327db) Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
|
GH-122258 is a backport of this pull request to the 3.13 branch. |
|
GH-122259 is a backport of this pull request to the 3.12 branch. |
Member
|
Thank you for your contribution @MKuranowski. |
serhiy-storchaka
pushed a commit
that referenced
this pull request
Jul 25, 2024
…GH-122110) (GH-122258) (cherry picked from commit a3327db) Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
serhiy-storchaka
pushed a commit
that referenced
this pull request
Aug 9, 2024
…GH-122110) (GH-122259) (cherry picked from commit a3327db) Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an inconsistency in the _csv.c module, whereby escapechars at the beginning of the field imply that fields are quoted, but escape characters at any other position do not. This only really affects parsing with QUOTE_NONNUMERIC - fields starting with the escape character are incorrectly left as a string, instead of being parsed.
With this change escapechars do not imply a quoted field; which allows fields like
"\\.5"with QUOTE_NONNUMERIC to be correctly parsed as0.5.Closes #113785.