Repository navigation
Fall back to read for unimplemented readinto adapters - #501
Conversation
|
That's a very obscure error case. Did you stumble upon this naturally? |
|
This came from a deliberate check of the virtual-I/O interface, using a constructed The failing PyPy jobs exposed a test assumption: PyPy's |
|
I'm not sure if this is really a bug worth fixing, as it kind of relys on a maliciously ill-constructed data structure. But the change is small and simple enough, and the tests are worth having. Is this ready to merge from your end? |
|
Yes, the current head is ready from the technical side. The full native suite still passes all 344 tests, and all 16 recorded-audio adapter workflows match the independent sample and feature references. The runtime correction remains unchanged; the latest commit only makes the regression portable to PyPy. |
A read-only adapter can implement
read,seekandtellwhile inheriting an unimplementedio.RawIOBase.readinto. SoundFile calls the inherited method and fails format detection instead of using its existingread()fallback.Treat
NotImplementedErrorlike an absentreadintomethod. Adapters with a workingreadintokeep that path.Before: a callback
NotImplementedError, followed byLibsndfileError: Format not recognised. After:[1, 256, -2345].Four WAV/FLAC mono/stereo regressions fail before and pass after; a working-readinto control stays on its original path. All 16 recorded LJSpeech/AMI whole-file/block decoding workflows now complete with exactly the direct-reader samples and independent NumPy frame-energy/spectral features.
Validation: full native suite: 344 passed; CI error lint and diff checks pass. Combined validation with the separate byte-order correction passes 368 tests and all 29 new regressions. Pyright retains the same two existing
dirname(_libname)errors as untouched master. Python 3.12/Linux with libsndfile 1.0.31; no cloud-provider, non-blocking-stream or other-platform claim.The virtual-I/O compatibility probe uses a constructed RawIOBase adapter; no production adapter failure was observed. The regression supplies its unimplemented method explicitly for PyPy portability. Full CPython 3.12 and PyPy 3.10 suites pass (344 cases each), and all sixteen recorded adapter workflows agree on both interpreters.