winUser.WinTimer: ensure timerFunc is correctly wrapped as a TIMERPROC even when None.#18925
Merged
Conversation
…C even when None.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a ctypes compatibility issue where passing None as a timer callback function to SetTimer fails in 64-bit environments due to stricter type checking. The fix ensures that timer functions are properly wrapped as TIMERPROC types, with None being converted to TIMERPROC(0).
- Adds type conversion logic to handle different timerFunc input types
- Ensures None values are properly converted to typed null function pointers
- Maintains backward compatibility while fixing 64-bit ctypes strictness
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…se a standard if/elif/else
Contributor
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
Run from source, confirmed #18907 has been fixed. |
SaschaCowley
approved these changes
Sep 15, 2025
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.
Link to issue number:
Fixes #18907
Fixes #18914
Summary of the issue:
Tightening up ctypes definitions for 64 bit means that ctypes may be more picky with what can be passed as an argument. In particular passing None to an argument that should be a callback now will fail.
The correct way is now to pass Functype(0) where Functype is the callback's ctypes definition.
So far just one call has been identified in #18914: SetTimer takes a TIMERPROC.
Description of user facing changes:
None.
Description of developer facing changes:
Description of development approach:
winUser.WinTimernow ensures thattimerFuncis already, or is converted to, aTIMERPROC. Specifically ensuringNoneis converted toTIMERPROC(0).Testing strategy:
Known issues with pull request:
None known.
Code Review Checklist: