Repository navigation
Preserve falsey supplied loggers and output files - #1345
Open
Quinnod345 wants to merge 1 commit into
Open
Quinnod345 wants to merge 1 commit into
Quinnod345 wants to merge 1 commit into
Conversation
Choose the default logger and output stream only for None. Conforming objects with an empty record buffer or a false truth value must retain their identity and receive the requested debug and trace output. Add regressions for a falsey logger and both trace modes of a falsey writable stream. All three fail before the repair. The 69 configuration tests and 1687-test suite pass afterward on CPython3.13.11/macOS, with 100% line and branch coverage, source Ruff and strict-bytes Mypy.
agammann
reviewed
Nov 7, 2026
agammann
left a comment
There was a problem hiding this comment.
Using an explicit is None fallback preserves a caller-supplied logger or output stream even when its truth value is false. The new tests exercise a falsey logger and a falsey file for both trace settings, and check that messages do not fall through to stderr. I reviewed the source and tests; I did not run them locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing a conforming custom logger whose empty record buffer makes it falsey to
H2Configuration(logger=...)silently replaces it withDummyLogger.OutputLogger(file=...)has the same fallback for a valid falsey writable stream, so its output goes to stderr instead of the selected stream.Select the defaults only when the argument is
None. The new regressions cover an empty logger and a falsey writable stream with trace enabled and disabled. The existing default tests continue to pass.Validation on CPython 3.13.11/macOS:
a90a82dbefore the implementation changes.I maintain Ponder. Its review flagged this case; the regressions reproduce it.