Skip to content

Conversation

@shbhmexe
Copy link

Proposed Changes

This PR contains small, behavior-preserving fixes in SU2’s Python tooling:

  • SU2_PY/SU2/run/interface.py: make run_command() safer and more reliable by using communicate() to avoid stderr pipe deadlocks, improving stderr decoding robustness, and fixing a wrong “Path = …” diagnostic.
  • SU2_PY/OptimalPropeller.py: use raw strings for matplotlib labels to avoid invalid escape sequence warnings and ensure LaTeX-like labels render correctly.
  • SU2_PY/parallel_computation_fsi.py: remove a duplicated assignment in solution merge setup.

Issues found and fixed (tool-related)

  1. SU2_PY/SU2/run/interface.pyrun_command() robustness
  • Fixes a potential deadlock/hang scenario by switching from wait() + stderr.read() to communicate() (drains stderr while the process runs).
  • Makes stderr decoding robust (errors="replace") to avoid wrapper crashes on non-UTF8 output (common on Windows).
  • Fixes an incorrect diagnostic path in the error message (os.path.abspath(",")os.path.abspath(".")).
  1. SU2_PY/OptimalPropeller.py – invalid escape sequence warnings
  • Converts matplotlib label strings to raw strings so LaTeX-like expressions don’t trigger SyntaxWarning: invalid escape sequence and render as intended.
  1. SU2_PY/parallel_computation_fsi.py – redundant assignment
  • Removes a duplicated config.SOLUTION_FILENAME = config.RESTART_FILENAME line (no behavior change, but prevents confusion and keeps merge setup consistent).

Reasoning / Impact

  • Improves reliability of the Python wrapper when running external SU2 commands (prevents rare hangs, improves error reporting).
  • Removes Python warnings that can break strict CI configurations (e.g., treating warnings as errors) and improves correctness of plot labels.
  • No new features and no solver behavior changes intended.

Validation

  • python -m compileall SU2_PY succeeds.
  • Changes are localized and do not alter solver inputs/outputs; they only improve robustness/clarity in wrapper behavior.

- Avoid potential deadlocks by draining stderr with communicate()
- Decode stderr with errors="replace" for robustness on Windows
- Fix incorrect Path value in run_command failure message
- Remove redundant SOLUTION_FILENAME assignment in parallel_computation_fsi
- Use raw strings in OptimalPropeller plot labels to avoid invalid escape warnings

Signed-off-by: shbhmexe <shubhushukla586@gmail.com>
@bigfooted bigfooted merged commit f27b335 into su2code:develop Dec 23, 2025
37 of 38 checks passed
@shbhmexe shbhmexe deleted the fix/su2-py-tool-stability branch December 23, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants