From 70477adef668c884b8b342d3e099caab9a6c3d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurycy=20Paw=C5=82owski-Wiero=C5=84ski?= <5383+maurycy@users.noreply.github.com> Date: Thu, 11 Sep 2025 17:11:33 +0200 Subject: [PATCH] gh-138005: Document that CSV `skipinitialspace=True` and `delimiter=' '` require quotation for empty fields (GH-138006) (cherry picked from commit e0f54a608eae7cb062b3b22d1b39a0f3fba3e8cb) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com> --- Doc/library/csv.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index c11c9b8b2bfbe7..3ea7cd210f729d 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -468,7 +468,8 @@ Dialects support the following attributes: .. attribute:: Dialect.skipinitialspace When :const:`True`, spaces immediately following the *delimiter* are ignored. - The default is :const:`False`. + The default is :const:`False`. When combining ``delimiter=' '`` with + ``skipinitialspace=True``, unquoted empty fields are not allowed. .. attribute:: Dialect.strict @@ -637,7 +638,7 @@ done:: .. rubric:: Footnotes .. [1] If ``newline=''`` is not specified, newlines embedded inside quoted fields - will not be interpreted correctly, and on platforms that use ``\r\n`` linendings + will not be interpreted correctly, and on platforms that use ``\r\n`` line endings on write an extra ``\r`` will be added. It should always be safe to specify ``newline=''``, since the csv module does its own (:term:`universal `) newline handling.