Skip to content

Fix reflash callback ownership and error handling - #259

Open
drebbe-intrepid wants to merge 1 commit into
masterfrom
codex/fix-241-reflash-callback
Open

drebbe-intrepid wants to merge 1 commit into
masterfrom
codex/fix-241-reflash-callback

Conversation

@drebbe-intrepid

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

Copy link
Copy Markdown
Collaborator

Fixes #241.

set_reflash_callback() now owns its registered handler until replacement or unregistration and keeps an in-flight reference so callbacks can safely unregister themselves. Invalid handlers and failed symbol lookup preserve the existing registration. Progress callbacks release their return values and report exceptions through sys.unraisablehook; Unicode conversion also works on CPython 3.14. Existing callable, reflash_callback method, no-argument stdout, and None disable modes remain supported.

Validation: rebuilt the extension on Windows x64 with CPython 3.14.5 and 3.12.10; all 42 tests passed on each, including 12 new hardware-free native mock cases. The lifetime regression failed against the original build. Coverage includes dropped owner, replacement, unregistration, self-unregistration, invalid handlers, attribute errors, missing native symbol, result cleanup, exceptions, Unicode stdout, worker-thread delivery, and delivery during registration. No hardware operations performed.

Independent critic /root/critic explicitly agreed with the final diff and independently ran all 42 tests. Builder also explicitly agreed before publication. Reviewed commit: 7b74272a35bf5380fdf121583d472bd710032149 (identical reviewed blobs). Parent coordinator retains CI acceptance, integration, hardware testing, and merge responsibility.

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.

[P1] set_reflash_callback keeps a borrowed reference that can be collected before use

1 participant