Skip to content

Docs: Describe csv.reader conversions for all quoting modes - #158426

Open
esadomer wants to merge 1 commit into
python:mainfrom
esadomer:b01-p004-csv-reader-conversions
Open

esadomer wants to merge 1 commit into
python:mainfrom
esadomer:b01-p004-csv-reader-conversions

Conversation

@esadomer

Copy link
Copy Markdown
Contributor

Summary

Update the csv.reader overview to describe conversions performed by QUOTE_STRINGS and QUOTE_NOTNULL. It currently says all fields are strings unless QUOTE_NONNUMERIC is used, contradicting the descriptions of the newer quoting modes.

import csv

row = ',3,"5","",'
assert next(csv.reader([row], quoting=csv.QUOTE_STRINGS)) == [None, 3.0, "5", "", None]
assert next(csv.reader([row], quoting=csv.QUOTE_NOTNULL)) == [None, "3", "5", "", None]

The revised text distinguishes non-empty unquoted fields converted to floats from empty unquoted fields converted to None.

Validation

  • Built CPython 3.16.0a0 from the checkout with PCbuild\build.bat -p x64 -d -M on Windows 10 x64 (MSVC 19.30).
  • PCbuild\amd64\python_d.exe -m test test_csv: SUCCESS (run=156, skipped=0).
  • Verified the examples and boundary cases with the same debug interpreter.
  • python -m sphinx -W --keep-going -j 1 -b html -d build/doctrees . build/html from Doc: incremental HTML build passed with Sphinx 8.2.3. The clean baseline build reported an existing duplicate customization label in using/windows.rst and reference/datamodel.rst.
  • python -m sphinxlint Doc/library/csv.rst, PCbuild\amd64\python_d.exe Tools\patchcheck\patchcheck.py, and git diff --check: passed.

This changes documentation only. No NEWS entry is needed. The full interpreter test suite was not run.

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Sep 29, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34831752 | 📁 Comparing 13b288e against main (84d4601)

  🔍 Preview build  

1 file changed
± library/csv.html

@esadomer
esadomer marked this pull request as ready for review September 29, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant