This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients eric.smith
Date 2020-05-30.12:31:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590841893.39.0.979050889653.issue40825@roundup.psfhosted.org>
In-reply-to
Content
Currently, the csv library calls str() on each value it writes. This can lead to surprising behavior, see issue40762 for example.

On the other hand, for writing the documentation says that the values must be strings or numbers.

The proposed "strict" argument would raise a TypeError if the supplied values are not strings, numbers, or None.

See https://github.com/python/cpython/blob/ba1c2c85b39fbcb31584c20f8a63fb87f9cb9c02/Modules/_csv.c#L1203 for where str() is called.

The documentation should be changed to note that None is allowed. Currently, None results in an empty string. I'm not proposing to change this, just document it as one of the allowed types.

How to check for "value is a number" needs to be decided.
History
Date User Action Args
2020-05-30 12:31:33eric.smithsetrecipients: + eric.smith
2020-05-30 12:31:33eric.smithsetmessageid: <1590841893.39.0.979050889653.issue40825@roundup.psfhosted.org>
2020-05-30 12:31:33eric.smithlinkissue40825 messages
2020-05-30 12:31:32eric.smithcreate