mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-67044: Always quote or escape \r and \n in csv.writer() (GH-115741) (GH-115866)
(cherry picked from commit c688c0f130
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
10907bdad3
commit
4ac657a62f
3 changed files with 43 additions and 15 deletions
|
@ -1109,6 +1109,8 @@ join_append_data(WriterObj *self, int field_kind, const void *field_data,
|
|||
if (c == dialect->delimiter ||
|
||||
c == dialect->escapechar ||
|
||||
c == dialect->quotechar ||
|
||||
c == '\n' ||
|
||||
c == '\r' ||
|
||||
PyUnicode_FindChar(
|
||||
dialect->lineterminator, c, 0,
|
||||
PyUnicode_GET_LENGTH(dialect->lineterminator), 1) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue