From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:18:42 +0000 (+0200) Subject: [3.13] gh-138005: Document that CSV `skipinitialspace=True` and `delimiter=' '` requi... X-Git-Tag: v3.13.8~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5f7e02ddf59518eadea1325db7e33217341b59b;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-138005: Document that CSV `skipinitialspace=True` and `delimiter=' '` require quotation for empty fields (GH-138006) (#138799) Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com> --- diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index c11c9b8b2bfb..3ea7cd210f72 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.