python / python/cpython

`csv.get_dialect()` returns a `_csv.Dialect` object, not `csv.Dialect` as documented.

Open
#138,352 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

The documentation at https://docs.python.org/3/library/csv.html#csv.Dialect indicates that this class is what is returned when calling csv.get_dialect(). But the C implemented class _csv.Dialect() is returned instead.

>>> import csv
>>> csv.get_dialect("excel")
<_csv.Dialect object at 0x0000026C0004DBC0>

This makes writing typesafe code that uses Dialect a challenge. See related typeshed issue at https://github.com/python/typeshed/issues/14667

It's not clear whether this is a documentation or implementation issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the csv.get_dialect() entry point and the csv.Dialect documentation linked in the issue, then compare the documented return type with the _csv.Dialect class produced at runtime. Check the related typeshed issue for typing context. Done means deciding whether documentation or implementation should change and aligning the public behavior and types accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.