Skip to content

Fix device reopen errors and failed-open handle ownership - #254

Open
drebbe-intrepid wants to merge 6 commits into
masterfrom
codex/fix-245-device-reopen
Open

drebbe-intrepid wants to merge 6 commits into
masterfrom
codex/fix-245-device-reopen

Conversation

@drebbe-intrepid

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

Copy link
Copy Markdown
Collaborator

Opening the same PyNeoDeviceEx twice raised SystemError after 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/critic245 reviewed 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.

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] Opening a device with an existing capsule returns SystemError after native success

1 participant