gh-131885: update documented signatures for csv.{writer,reader}#136085
gh-131885: update documented signatures for csv.{writer,reader}#136085ZeroIntensity merged 1 commit intopython:mainfrom
csv.{writer,reader}#136085Conversation
…ter` have some positional-only arguments
```python
import csv
with open("example.csv", "w", newline='') as csvfile:
csv.writer(csvfile=csvfile) # TypeError: expected at least 1 argument, got 0
```
```python
import csv
csv.reader(csvfile="a") # TypeError: expected at least 1 argument, got 0
```
ZeroIntensity
left a comment
There was a problem hiding this comment.
LGTM.
Reading the source, I was a little confused at first:
Lines 1090 to 1100 in bd928a3
PyArg_UnpackTuple unpacks positional arguments, so I would have thought that csv.writer(file, dialect="...") wouldn't work, but the catch is that _call_dialect checks if the dialect was non-NULL, and extracts it from the keywords if it is. But, there's nothing similar for csvfile, so this is the correct description for the docs.
csv.reader and `csv.wri…csv.{writer,reader}
|
Thanks @adamtheturtle for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…}` (pythonGH-136085) (cherry picked from commit 75f4059) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
…}` (pythonGH-136085) (cherry picked from commit 75f4059) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
|
GH-136120 is a backport of this pull request to the 3.14 branch. |
|
GH-136121 is a backport of this pull request to the 3.13 branch. |
|
Thanks! |
…ter` have some positional-only arguments
*and/as needed #131885📚 Documentation preview 📚: https://cpython-previews--136085.org.readthedocs.build/