gh-137986: Fix and improve the csv functions docstrings#137987
Merged
serhiy-storchaka merged 3 commits intopython:mainfrom Aug 24, 2025
Merged
gh-137986: Fix and improve the csv functions docstrings#137987serhiy-storchaka merged 3 commits intopython:mainfrom
serhiy-storchaka merged 3 commits intopython:mainfrom
Conversation
The csv.register_dialect() docstring no longer imply that it returns a dialect. All functions have now signatures.
maurycy
approved these changes
Aug 20, 2025
Member
Author
|
The diff of the pydoc output: @@ -149,58 +149,45 @@
field_size_limit(new_limit=<unrepresentable>)
Sets an upper limit on parsed fields.
- csv.field_size_limit([limit])
-
Returns old limit. If limit is not given, no new limit is set and
the old limit is returned
get_dialect(name)
Return the dialect instance associated with name.
- dialect = csv.get_dialect(name)
-
list_dialects()
Return a list of all known dialect names.
- names = csv.list_dialects()
-
- reader(...)
- csv_reader = reader(iterable [, dialect='excel']
- [optional keyword args])
- for row in csv_reader:
- process(row)
+ reader(iterable, /, dialect='excel', **fmtparams)
+ Return a reader object that will process lines from the given iterable.
The "iterable" argument can be any object that returns a line
of input for each iteration, such as a file object or a list. The
- optional "dialect" parameter is discussed below. The function
+ optional "dialect" argument defines a CSV dialect. The function
also accepts optional keyword arguments which override settings
provided by the dialect.
The returned object is an iterator. Each iteration returns a row
of the CSV file (which can span multiple input lines).
- register_dialect(...)
- Create a mapping from a string name to a dialect class.
- dialect = csv.register_dialect(name[, dialect[, **fmtparams]])
+ register_dialect(name, /, dialect='excel', **fmtparams)
+ Create a mapping from a string name to a CVS dialect.
+
+ The optional "dialect" argument specifies the base dialect instance
+ or the name of the registered dialect. The function also accepts
+ optional keyword arguments which override settings provided by the
+ dialect.
unregister_dialect(name)
Delete the name/dialect mapping associated with a string name.
- csv.unregister_dialect(name)
-
- writer(...)
- csv_writer = csv.writer(fileobj [, dialect='excel']
- [optional keyword args])
- for row in sequence:
- csv_writer.writerow(row)
-
- [or]
-
- csv_writer = csv.writer(fileobj [, dialect='excel']
- [optional keyword args])
- csv_writer.writerows(rows)
+ writer(fileobj, /, dialect='excel', **fmtparams)
+ Return a writer object that will write user data on the given file object.
The "fileobj" argument can be any object that supports the file API.
+ The optional "dialect" argument defines a CSV dialect. The function
+ also accepts optional keyword arguments which override settings
+ provided by the dialect.
|
Member
|
Oh so the other change is part of this PR. Good. |
maurycy
reviewed
Aug 20, 2025
Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
Member
Author
|
Other changes for @@ -128,17 +128,15 @@
|
| Methods defined here:
|
- | writerow(self, object, /)
- | writerow(iterable)
+ | writerow(self, row, /)
+ | Construct and write a CSV record from an iterable of fields.
|
- | Construct and write a CSV record from an iterable of fields. Non-string
- | elements will be converted to string.
+ | Non-string elements will be converted to string.
|
- | writerows(self, object, /)
- | writerows(iterable of iterables)
+ | writerows(self, rows, /)
+ | Construct and write a series of iterables to a csv file.
|
- | Construct and write a series of iterables to a csv file. Non-string
- | elements will be converted to string.
+ | Non-string elements will be converted to string.
|
| ----------------------------------------------------------------------
| Data descriptors defined here: |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Aug 24, 2025
…GH-137987) The csv.register_dialect() docstring no longer imply that it returns a dialect. All functions have now signatures. (cherry picked from commit aa1dbd4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
GH-138107 is a backport of this pull request to the 3.14 branch. |
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this pull request
Aug 24, 2025
…ythonGH-137987) The csv.register_dialect() docstring no longer imply that it returns a dialect. All functions have now signatures. (cherry picked from commit aa1dbd4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
|
GH-138108 is a backport of this pull request to the 3.13 branch. |
krisztian-gajdar
added a commit
to krisztian-gajdar/cpython
that referenced
this pull request
Aug 24, 2025
…tuations docs: add news entry for TracebackException punctuation fix style: remove trailing whitespace in traceback.py Update 2025-08-24-11-42-38.gh-issue-137716.7-Mtj-.rst Update 2025-08-24-11-42-38.gh-issue-137716.7-Mtj-.rst refactor: improve suggestion message computation and punctuation handling style: remove trailing whitespace in traceback.py pythongh-137986: Fix and improve the csv functions docstrings (pythonGH-137987) The csv.register_dialect() docstring no longer imply that it returns a dialect. All functions have now signatures. Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com> pythongh-135261: bring back CI job for testing OpenSSL 1.1.1w (python#135262) This partially reverts commit d83e30c by bringing back the CI job for testing OpenSSL 1.1.1w. Despite this version being upstream EOL, the rationale for keeping it as follows: - It most resembles other 1.1.1-work-a-like ssl APIs supported by important vendors. - Python officially requires OpenSSL 1.1.1 or later, although OpenSSL 3.0 or later is recommended for cryptographic modules. Since changing the build requirements requires a transition period, we need to keep testing the allowed versions. - The code base still contains calls to OpenSSL functions that are deprecated since OpenSSL 3.0 as well as `ifdef` blocks constrained to OpenSSL 1.1.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The csv.register_dialect() docstring no longer imply that it returns a dialect.
All functions have now signatures.