Skip to content

Handle basicConfig calls that create no handlers - #142

Open
jadenfix wants to merge 1 commit into
borntyping:mainfrom
jadenfix:fix/basicconfig-empty-handlers
Open

jadenfix wants to merge 1 commit into
borntyping:mainfrom
jadenfix:fix/basicconfig-empty-handlers

Conversation

@jadenfix

Copy link
Copy Markdown

colorlog.basicConfig(handlers=[]) raises IndexError after the standard library accepts the configuration and leaves the root logger without handlers. This also affects handlers=[], force=True when tearing down an existing configuration.

Skip formatter replacement when there is no handler, while holding the existing logging lock. The current nonempty-handler behavior is preserved. Tests cover empty configuration and actual output through a supplied handler.

Validation: the new empty-handler regression fails on main; the full suite passes on Python 3.14 with colorama (37 tests) and Python 3.9 without colorama (35 tests). The documented CI commands for Black, Flake8, and mypy pass. An installed wheel passes empty setup, subsequent stream logging, forced teardown, and replacement-handler output checks. A separate AI reviewer checked the final commit and independently reran all 37 tests. Prepared with AI assistance.

This branch has not been deployed

No deployments
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