-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
csv.writer converts None to '""\n' when it is first line, otherwise '\n' #76436
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
Inconsistent behavior while reading a single column CSV. # Case 1
## Output
# Case 2
## Output
|
Which scenario you think is the wrong behaviour in this case? First one or second one? I don't know much about csv module, but I thought it was a deliberate choice made to quote all empty lines and hence considered the second scenario as buggy. But your pull requests seems to fix the first case. Am I missing something here? |
I think the first one is buggy and there are two reasons.
## Output:
These seem inconsistent and the quoting is unnecessary in this case. # References |
The current implementation does not quote in most case. IOW, the patch which makes all '' is quoted is the breaking change (Note that there are some applications does not use quoting). |
Serhiy, since it was your patch that probably introduced this bug, can you take a look? Obviously it isn't a very high priority bug, since no one has reported a problem (even this issue isn't reporting the change in behavior as a *problem* :) |
For restoring the 3.4 behavior the single empty field must be quoted. This allows to distinguish a 1-element row with the single empty field from an empty row. |
Thanks for your investigation! |
PR is now fixed so as to follow the behavior on Python 2.7! |
Thank you for your contribution Licht! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: