Skip to content

Allow explicit streams on StandardErrorHandler - #125

Open
Aschenbath wants to merge 1 commit into
xolox:masterfrom
Aschenbath:fix/standard-error-handler-stream-106
Open

Aschenbath wants to merge 1 commit into
xolox:masterfrom
Aschenbath:fix/standard-error-handler-stream-106

Conversation

@Aschenbath

Copy link
Copy Markdown

Fixes #106.

Calling setStream() on the handler installed by coloredlogs raises AttributeError because its stream property is read-only. Add a setter that remembers an explicit destination. The handler continues to follow changes to sys.stderr until a destination is assigned, and the inherited setStream() retains its flush and return-value behavior.

Five portable tests cover replacement, repeated replacement, same-stream no-ops, explicit None, and installation. Four fail on the original source; all pass on Python 3.10 and against the installed wheel on Python 3.12. Flake8 and wheel/sdist builds pass. Independent differential checks cover 6,000 operations against logging.StreamHandler, including false-valued streams and failed flushes. The original suite cannot collect on Windows because its capturer dependency imports termios; it is not reported as passing. Developed and reviewed with Codex agents.

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.

stream's StandardErrorHandler shouldn't be a property

1 participant