Skip to content

fix(python): use context managers in standalone pfm IO - #9804

Open
Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-pfm-context-managers-20260722
Open

Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-pfm-context-managers-20260722

Conversation

@Bartok9

@Bartok9 Bartok (Bartok9) commented Jul 22, 2026 •

Copy link
Copy Markdown

Summary

  • Rewrite standalone PythonClient/airsim/pfm.py read/write to use with open(...) so handles close on exception paths.
  • Drop unused matplotlib / pdb imports (blocked headless offline unit tests).
  • Add offline gray/color roundtrip unittest.

Motivation

The standalone PFM helpers opened files without context managers (file.close() only on the success path for reads; write never explicit-close). Mid-parse failures could leak FDs. GUI imports also made casual import of the helper heavy / fragile.

Note: utils.py has parallel PFM helpers (#9796 hardens those); this PR is the standalone pfm.py module used by some samples.

Verification

  • PYTHONPATH=PythonClient python3 -m unittest tests.test_pfm_roundtrip -v → 3 passed
  • No arm/geofence changes
  • Orthogonal to open utils.py / types.py Bartok9 stack

Notes


Agent-Owner: sera · Platform: hermes · Claim-TTL: 24h

Claim: bartok
Operator: bartok
Campaign: aerial-drone

Close PFM handles on all paths and drop unused matplotlib/pdb imports
so offline roundtrips work without GUI deps.

Signed-off-by: Bartok9 <danielrpike9@gmail.com>
@Bartok9
Bartok (Bartok9) force-pushed the aerial/python-pfm-context-managers-20260722 branch from 24b899e to 1b96d3e Compare October 25, 2026 21:27

This branch has not been deployed

No deployments
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.

1 participant