-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Additional validation of CSV Dialect parameters #113796
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
Comments
…uctor ValueError is now raised if the same character is used in different roles.
…H-113797) ValueError is now raised if the same character is used in different roles.
…uctor (pythonGH-113797) ValueError is now raised if the same character is used in different roles.
This changed possibly broke docutils - it was built successfully with Python 3.13.0a1 to a3, started failing in a4 in Fedora's Copr environment: https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07033758-python-docutils/builder-live.log.gz
|
Thank you for your report. It fails if the delimiter is
I guess that the problem is caused by It is perhaps a Python failure. I see now a use case for such combination. Opened #115712. |
…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.
…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>
…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.
…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.
…uctor (pythonGH-113797) ValueError is now raised if the same character is used in different roles.
…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.
Feature or enhancement
CSV writer and reader allow to configure parameters of the CSV dialect. They check for some incompatible combination, for example quotechar must be set if quoting enabled. But it is still possible to specify values that produce ambiguous output which cannot be parsed neither by the CSV reader not by any other CSV parser. For example if any two of delimiter, quotechar or escapechar match. The error can be only noticed when try to read the CSV file, and it can simply produce wrong result instead of failing.
I propose to add more validation checks in addition to existing checks in the Dialect constructor.
Linked PRs
The text was updated successfully, but these errors were encountered: