cleanup: remove observation logic deadcode - #456
Merged
Merged
Conversation
ahmad-ajmal
marked this pull request as ready for review
September 22, 2026 10:32
_install_routed_streams wrapped sys.stdout/sys.stderr unconditionally. The installer is frozen with console=False (packaging/CraftBotInstaller.spec), so under pythonw both are None -- the wrapper then held None as its fallback and every write from a non-routed thread raised "AttributeError: 'NoneType' object has no attribute 'write'". CPython's print() is a silent no-op when sys.stdout is None, so before this the same stray library print did nothing. Wrapping turned a no-op into a crash in the shipped, windowed build, and sys.stdout.encoding -- read by a lot of ordinary code -- crashed with it. A _NullStream stand-in restores the no-op and answers the attributes a stream is expected to have, so the per-thread routing this commit's parent introduced keeps working with or without a console. Reproduced by setting sys.stdout = None and calling print() through the wrapper: AttributeError before, silent no-op after, with worker-thread routing unchanged. Tests live under tests/ so `pytest` actually collects them (pytest.ini sets testpaths = tests).
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.
No description provided.