Skip to content

cleanup: remove observation logic deadcode - #456

Merged
korivi-CraftOS merged 3 commits into
V1.4.3from
ahmad/observation-system-deadcode
Sep 23, 2026
Merged

korivi-CraftOS merged 3 commits into
V1.4.3from
ahmad/observation-system-deadcode

Conversation

@ahmad-ajmal

Copy link
Copy Markdown
Collaborator

No description provided.

@ahmad-ajmal ahmad-ajmal self-assigned this Sep 22, 2026
@ahmad-ajmal
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).
@korivi-CraftOS
korivi-CraftOS merged commit e15ed5f into V1.4.3 Sep 23, 2026
@zfoong
zfoong deleted the ahmad/observation-system-deadcode branch September 29, 2026 06:37
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.

2 participants