Skip to content

fix(python): use np.frombuffer in string_to_*_array helpers - #9795

Open
Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-frombuffer-utils-20260721
Open

Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-frombuffer-utils-20260721

Conversation

@Bartok9

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

Copy link
Copy Markdown

Summary

numpy.fromstring binary mode is deprecated and removed in NumPy 2.x, which breaks AirSim’s public helpers used by samples (string_to_uint8_array / string_to_float_array).

This switches those helpers to np.frombuffer with a small bytes-like coerce path for msgpack/legacy str buffers, returning writable copies (same practical behavior as the old helpers).

Motivation

Users on modern NumPy could not decode packed image buffers through the supported helpers without warnings or failures.

Verification

  • Offline unit check of uint8/float32 round-trip and empty/None buffers on the patched helpers
  • Diff limited to PythonClient/airsim/utils.py
  • AI-assisted; human-reviewed. Human author trailers only.

Claim: bartok
Operator: bartok
Campaign: aerial-drone

np.fromstring's binary mode is deprecated and removed in NumPy 2.x.
Coerce msgpack/legacy buffers to bytes and return writable copies so
samples using string_to_uint8_array keep working on modern NumPy.
@Bartok9
Bartok (Bartok9) force-pushed the aerial/python-frombuffer-utils-20260721 branch from 7d1f868 to ad5f3f3 Compare October 25, 2026 21:28

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