fix: silence openstudio stdout Logger to prevent Polyhedron/Space pollution#49
Merged
Merged
Conversation
…out pollution Two-layer defense at server startup: 1. silence_openstudio_stdout_logger() — new, sets standardOutLogger to Fatal via the intended Logger API. Primary fix for Polyhedron/Space warnings on stdout during Space::volume() (the bulk of pollution in practice). 2. redirect_c_stdout_to_stderr() — unchanged, remains as backstop for SWIG memleak warnings in edge cases and future unknown C stdout writes. Adds 3 regression tests in tests/test_stdout_logger_silence.py including a falsification test that resets to Warn to prove the pollution is real. Upstream SWIG memleak root cause filed as NatLabRockies/OpenStudio#5608 (PyPI wheel missed #5422 SWIG_PYTHON_SILENT_MEMLEAK define). Fixes #48 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- UP020: io.open → builtin open - SIM115: add noqa (intentional — file outlives function, becomes sys.stdout) - PTH123: add noqa (fd, not a path — Path.open() inapplicable) - SIM105: try/except/pass → contextlib.suppress in atexit handler No behavior change. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
silence_openstudio_stdout_logger()tostdout_suppression.py, called fromserver.py::main()beforeredirect_c_stdout_to_stderr(). SetsstandardOutLoggerlevel toFatalvia the intended Logger API — primary fix for Polyhedron/Space warnings reaching C stdout duringSpace::volume().tests/test_stdout_logger_silence.py) including a falsification test that resets to Warn to prove the pollution is real.Fixes #48. Upstream SWIG memleak root cause filed as NatLabRockies/OpenStudio#5608 (PyPI wheel missed #5422's
SWIG_PYTHON_SILENT_MEMLEAKdefine).Test plan
pytest tests/test_stdout_logger_silence.py— 3/3 passpytest tests/test_swig_memleak_cleanup.py tests/test_stdio_smoke.py tests/test_concurrent_tools.py tests/test_stdout_logger_silence.py— 8/8 pass🤖 Generated with Claude Code