Skip to content

Fix crash when boolean flags are set via pyproject.toml - #107

Open
Qrytics wants to merge 1 commit into
albertas:mainfrom
Qrytics:pilot/slot-445
Open

Qrytics wants to merge 1 commit into
albertas:mainfrom
Qrytics:pilot/slot-445

Conversation

@Qrytics

@Qrytics Qrytics commented Nov 10, 2026

Copy link
Copy Markdown

Setting a boolean flag such as fix, dry, quiet, count or
verbose under [tool.deadcode] in pyproject.toml crashed the tool
with AttributeError: 'bool' object has no attribute 'extend'
instead of enabling the flag.

The pyproject merge path in parse_arguments unconditionally called
list.extend() on the parsed CLI value, which is a bool for
flag options. Boolean flags from pyproject.toml are now assigned
instead of extended; list options behave exactly as before.

Reproduce (before fix):

[tool.deadcode]
fix = true
$ deadcode .
AttributeError: 'bool' object has no attribute 'extend'

After the fix the run enables fix and completes normally.

Includes a regression test
(tests/cli_args/test_parsing.py::test_boolean_pyproject_setting_enables_flag)
that enables fix and count via a pyproject.toml in a temporary
directory: it fails with AttributeError before the fix and passes
after it. Full suite: no new failures versus the pre-existing
baseline (48 pre-existing environment failures, identical with and
without this change; the touched test file passes 18/18).

Setting a boolean flag such as fix, dry, quiet, count or verbose
under [tool.deadcode] crashed with AttributeError because the
pyproject merge path unconditionally called list.extend on the
parsed value. Boolean flags are now assigned instead of extended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant