fix: rtbtool's %precision line spuriously echoes its own return value - #592
Open
petercorke wants to merge 1 commit into
Open
fix: rtbtool's %precision line spuriously echoes its own return value#592petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
The default startup exec_lines included a bare "%precision %.3g" as the last statement, so it exits started IPython sessions and printed Out[1]: '%.3g' immediately before the first real prompt -- the magic's return value getting auto-displayed under normal IPython semantics (bare expressions display by default, independent of --showassign). Wrap it in run_line_magic() and print the result explicitly instead, so the last statement is a print() call (never auto-displayed) rather than a bare expression.
3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 142 142
Lines 13882 13882
=====================================
Misses 13882 13882 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4 tasks
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
rtbtool's default startupexec_linesend with a bare%precision %.3gas the last statement. IPython auto-displays the last bare-expression result by default (independent of--showassign), so every defaultrtbtoolsession prints a spuriousOut[1]: '%.3g'right before the first real prompt.get_ipython().run_line_magic(...), assigning the result, and printing it explicitly with a clear label — so the line's last statement is aprint()call, which is never auto-displayed.Found while doing the equivalent fix in RVC3-python's
rvctool(same class of bug, same root cause) —mvtbtoolhas a related but currently-latent version of this (only manifests with--showassign), tracked separately.Test plan
rtbtool --no-banner(default startup) — confirmed no moreOut[1]: '%.3g', showsDefault numeric formatting: %.3ginsteadpytest tests/test_bin.py— all 7 pass