Fix device reopen errors and failed-open handle ownership - #254
Open
drebbe-intrepid wants to merge 6 commits into
Open
drebbe-intrepid wants to merge 6 commits into
drebbe-intrepid wants to merge 6 commits into
Conversation
Reject already-open devices before a second native open. Correct capsule update status and release newly opened handles if Python assignment fails.
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.
Opening the same
PyNeoDeviceExtwice raisedSystemErrorafter a successful native open. Reject an already-open device before calling the native API, correct the capsule update return check, and close/free a newly opened handle when Python cannot store it. Closing a device still permits reopening it.Fixes #245.
Validation: Windows x64, CPython 3.14.5 rebuilt extension; all 34 tests passed. Hardware-free mock regressions cover repeated open, close/reopen, native open failure, and Python assignment failure (including cleanup close failure). Against the baseline, three new regression cases fail and the native-failure control passes. No hardware accessed.
Independent critic
/root/critic245reviewed the final source/test blobs and independently ran all 34 tests: “I explicitly agree with final commit dac8582. It corresponds to the reviewed merge: source and test blobs match, expected parents are present, and the working tree is clean.” Builder also explicitly agrees. Reviewed commit:dac858214f211301cce3f3c69fa064e8c42c7d71.Mock portability: selects Windows Python pointer width; x86 PE architecture and undecorated API exports verified. No x86 runtime available. Compiler and test subprocesses have timeouts.
Dependency integration: contains PR #256 (reference ownership fixes). Merge #256 before this PR. The setter uses RAII from #243 with #245 capsule status/reopen/rollback behavior. Rebuilt Windows CPython 3.14.5 extension: 17 affected tests passed independently for builder and critic after dependency merge. Earlier standalone validation: 34 tests passed.