gh-76728: Coerce DictReader and DictWriter fieldnames argument to a list (GH-32225)

This commit is contained in:
Sam Ezeh 2022-08-25 11:13:24 +01:00 committed by GitHub
parent c09fa7542c
commit cd492d43a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 0 deletions

View file

@ -167,6 +167,8 @@ The :mod:`csv` module defines the following classes:
All other optional or keyword arguments are passed to the underlying
:class:`reader` instance.
If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`.
.. versionchanged:: 3.6
Returned rows are now of type :class:`OrderedDict`.
@ -209,6 +211,8 @@ The :mod:`csv` module defines the following classes:
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
of the :class:`DictWriter` class is not optional.
If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`.
A short usage example::
import csv