Skip to content

Fix unreleased buffer exports in synchronous wrappers - #257

Open
drebbe-intrepid wants to merge 2 commits into
masterfrom
codex/fix-242-buffer-exports
Open

drebbe-intrepid wants to merge 2 commits into
masterfrom
codex/fix-242-buffer-exports

Conversation

@drebbe-intrepid

@drebbe-intrepid drebbe-intrepid commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #242

Synchronous UART/Generic API writes and accessory firmware calls leave their input buffers exported, preventing bytearray resize. Status and firmware-info getters retain their returned objects through unreleased exports and also leak their initial references on errors.

Add scoped export release for all six wrappers, check buffer acquisition before native calls, and own newly created result objects until successful return. Restore the GIL before reporting accessory operation errors. Native signatures and Python return values remain unchanged.

Validation:

  • Hardware-free mock library tests cover resize/collection on success, native failure, missing symbols, invalid device arguments, buffer acquisition failure, status/UART size mismatch, accessory error codes, and late argument parsing failure.
  • Baseline 45167e0 rebuilt separately: 24 regression failures, 5 passes.
  • Fixed Windows x64 CPython 3.14.5: all 59 tests pass (30 existing + 29 regression cases).
  • Independent critic /root/critic_242 explicitly agrees with the final diff and independently ran all 59 tests successfully; builder explicitly agrees. Reviewed three-file diff is committed as 13414b7.
  • No hardware, device traffic, or firmware access; accessory wrapper calls use only the mock library. Parent coordinator retains hardware testing, CI acceptance, integration, and merge responsibility.

Windows mock portability follow-up: compile for running Python bitness and provide undecorated i686 stdcall exports. Verified I386 PE header, all six API aliases, and missing-symbol DLL exports with llvm-readobj. All 59 x64 tests pass again, independently confirmed by critic /root/critic_242 with renewed explicit agreement; builder agrees. No 32-bit Python is installed, so x86 runtime validation remains pending.

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.

[P2] Unreleased Py_buffer exports lock write buffers and leak returned status objects

1 participant