Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV dialect with delimiter=' ' and skipinitialspace=True #115712

Closed
serhiy-storchaka opened this issue Feb 20, 2024 · 0 comments
Closed

CSV dialect with delimiter=' ' and skipinitialspace=True #115712

serhiy-storchaka opened this issue Feb 20, 2024 · 0 comments
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Feb 20, 2024

Bug report

Combination of delimiter=' ' and skipinitialspace=True was considered illegal in #113796, because it is ambiguous in case of empty fields. But there may be a use case for this, when the input is a preformatted table with a series of spaces considered as a delimiter:

apples  red     100
bananas yellow  3

Empty fields are not compatible with such format, so the writer should either quote them, or fail if quoting is not possible.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes labels Feb 20, 2024
@serhiy-storchaka serhiy-storchaka self-assigned this Feb 20, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 20, 2024
…ialspace=True

Restore support of such combination, disabled in pythongh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
serhiy-storchaka added a commit that referenced this issue Feb 20, 2024
…ce=True (GH-115721)

Restore support of such combination, disabled in gh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 20, 2024
…kipinitialspace=True (pythonGH-115721)

Restore support of such combination, disabled in pythongh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Feb 20, 2024
…tialspace=True (GH-115721) (GH-115729)

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282)
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 20, 2024
…' and skipinitialspace=True (pythonGH-115721) (pythonGH-115729)

(cherry picked from commit 5ea86f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282)
serhiy-storchaka added a commit that referenced this issue Feb 20, 2024
…tialspace=True (GH-115721) (GH-115729) (GH-115738)

(cherry picked from commit 5ea86f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282)
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this issue Mar 4, 2024
…ialspace=True (pythonGH-115721)

Restore support of such combination, disabled in pythongh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
…ialspace=True (pythonGH-115721)

Restore support of such combination, disabled in pythongh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant