GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-131885: update documented signatures for `csv.{writer,reader}` by adamtheturtle · Pull Request #136085 · python/cpython

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Jun 29, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

…ter` have some positional-only arguments

import csv

with open("example.csv", "w", newline='') as csvfile:
    csv.writer(csvfile=csvfile)  # TypeError:  expected at least 1 argument, got 0
import csv

csv.reader(csvfile="a")  # TypeError:  expected at least 1 argument, got 0
  • Issue: Update function signatures to use * and / as needed #131885

📚 Documentation preview 📚: https://cpython-previews--136085.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adamtheturtle
gh-131885: �Update csv.rst to describe that csv.reader and `csv.wri…
5ddc2ff
…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
```
@bedevere-app bedevere-app Bot added awaiting review docs Documentation in the Doc dir skip news labels Jun 29, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Jun 29, 2025
@github-project-automation github-project-automation Bot added this to Docs PRs Jun 29, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jun 29, 2025
Update function signatures to use * and / as needed #131885
Open
4 of 5 tasks
ZeroIntensity
ZeroIntensity approved these changes Jun 29, 2025
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Reading the source, I was a little confused at first:

cpython/Modules/_csv.c

Lines 1090 to 1100 in bd928a3

if (!PyArg_UnpackTuple(args, "reader", 1, 2, &iterator, &dialect)) {
Py_DECREF(self);
return NULL;
}
self->input_iter = PyObject_GetIter(iterator);
if (self->input_iter == NULL) {
Py_DECREF(self);
return NULL;
}
self->dialect = (DialectObj *)_call_dialect(module_state, dialect,
keyword_args);

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 29, 2025
@picnixz picnixz changed the title gh-131885: Update csv.rst to describe that csv.reader and `csv.wri… gh-131885: update documented signatures for csv.{writer,reader} Jun 29, 2025
@ZeroIntensity ZeroIntensity added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Jun 30, 2025
@ZeroIntensity
ZeroIntensity merged commit 75f4059 into python:main Jun 30, 2025
@miss-islington-app

miss-islington-app Bot commented Jun 30, 2025

Copy link
Copy Markdown

Thanks @adamtheturtle for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 30, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 30, 2025
@adamtheturtle @miss-islington
pythongh-131885: Update documented signatures for `csv.{writer,reader…
2013f28
…}` (pythonGH-136085)

(cherry picked from commit 75f4059)

Co-authored-by: Adam Dangoor <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 30, 2025
@adamtheturtle @miss-islington
pythongh-131885: Update documented signatures for `csv.{writer,reader…
85ac14b
…}` (pythonGH-136085)

(cherry picked from commit 75f4059)

Co-authored-by: Adam Dangoor <[email protected]>
@bedevere-app

bedevere-app Bot commented Jun 30, 2025

Copy link
Copy Markdown

GH-136120 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 30, 2025
@bedevere-app

bedevere-app Bot commented Jun 30, 2025

Copy link
Copy Markdown

GH-136121 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 30, 2025
@adamtheturtle
adamtheturtle deleted the patch-3 branch June 30, 2025 13:33
@ZeroIntensity

ZeroIntensity commented Jun 30, 2025

Copy link
Copy Markdown
Member

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ZeroIntensity pushed a commit that referenced this pull request Jun 30, 2025
@miss-islington @adamtheturtle
[3.13] gh-131885: Update documented signatures for `csv.{writer,reade…
ad5f88e
…r}` (GH-136085) (GH-136121)

gh-131885: Update documented signatures for `csv.{writer,reader}` (GH-136085)
(cherry picked from commit 75f4059)

Co-authored-by: Adam Dangoor <[email protected]>
ZeroIntensity pushed a commit that referenced this pull request Jun 30, 2025
@miss-islington @adamtheturtle
[3.14] gh-131885: Update documented signatures for `csv.{writer,reade…
ed7719a
…r}` (GH-136085) (GH-136120)

gh-131885: Update documented signatures for `csv.{writer,reader}` (GH-136085)
(cherry picked from commit 75f4059)

Co-authored-by: Adam Dangoor <[email protected]>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
@adamtheturtle @AndPuQing
pythongh-131885: Update documented signatures for `csv.{writer,reader…
e8d7647
…}` (pythonGH-136085)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@adamtheturtle @Pranjal095
pythongh-131885: Update documented signatures for `csv.{writer,reader…
bc05f11
…}` (pythonGH-136085)
picnixz pushed a commit to picnixz/cpython that referenced this pull request Jul 13, 2025
@adamtheturtle @picnixz
pythongh-131885: Update documented signatures for `csv.{writer,reader…
0c1180f
…}` (pythonGH-136085)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@adamtheturtle @taegyunkim
pythongh-131885: Update documented signatures for `csv.{writer,reader…
d73ddb1
…}` (pythonGH-136085)
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@adamtheturtle @Agent-Hellboy
pythongh-131885: Update documented signatures for `csv.{writer,reader…
2e0794a
…}` (pythonGH-136085)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity ZeroIntensity approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@adamtheturtle @ZeroIntensity
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.