Skip to content

Read only [tool.codespell] from TOML config#3975

Merged
larsoner merged 1 commit into
codespell-project:mainfrom
Sanjays2402:fix/toml-codespell-section
Jul 15, 2026
Merged

Read only [tool.codespell] from TOML config#3975
larsoner merged 1 commit into
codespell-project:mainfrom
Sanjays2402:fix/toml-codespell-section

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Fixes #3969.

parse_options() passed every direct child of [tool] to ConfigParser, so an unrelated array of tables such as [[tool.dynamic-metadata]] raised AttributeError. It now reads only [tool.codespell]; if that section is itself an array, codespell exits through its existing config-error path instead of showing a traceback.

Regression tests cover sibling arrays for both explicit and automatic pyproject.toml loading, plus the malformed-section case.

Passing every child of [tool] to ConfigParser made unrelated arrays of
tables crash option parsing.

Extract only [tool.codespell], reject a non-table codespell section through
the existing config error path, and cover both cases with regression tests.

Fixes codespell-project#3969
@ngoldbaum

Copy link
Copy Markdown

Thanks for the fix! I just hit this today in argon2-cffi-bindings.

@larsoner larsoner merged commit 57b2140 into codespell-project:main Jul 15, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants