Fix unreleased buffer exports in synchronous wrappers - #257
Open
drebbe-intrepid wants to merge 2 commits into
Open
drebbe-intrepid wants to merge 2 commits into
drebbe-intrepid wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.