python / python/typeshed

Should `None` be an acceptable `default_section` parameter of `configparser.ConfigParser`

Open
#12,700 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

Since this is typing related, I'll ask here before adding to cpython's 5k+ issues.

In https://github.com/pypa/setuptools/pull/4604#discussion_r1777834900 (read this comment for more details) , I found a usage of configparser.ConfigParser(default_section=None, delimiters=("=",)) seemingly to not have a default section.

The documentation doesn't make any mention of leveraging that behaviour. So we're left wondering if the parameter type should be updated (along as a request for cpython's doc to make it explicit), use "" instead, or just type-ignoring it, marking as using undocumented behaviour.

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 by reviewing the ConfigParser default_section annotation in the relevant typeshed stub and the linked setuptools discussion, then compare it with the documented and observed behavior. Done means resolving whether None is supported and updating the type or documenting the behavior accordingly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.