From 0bf725e1a493d9462d17269b67890e21121be9db Mon Sep 17 00:00:00 2001 From: Bram Duvigneau Date: Sat, 29 Jun 2024 16:59:50 +0200 Subject: [PATCH] Provide a local definition of user32.SetTimer, user32.KillTimer and ole32.CoGetApartmentType on Windows By overriding the type definition of SetTimer, we prevent None being passed as the callback parameter. This causes problems when integrating Bleak in larger Windows applications that call SetTimer in this way. By defining the function type definition locally, we don't override the global definition so existing code that uses None as a callback keeps working. To prevent other problems, we also make the definitions of KillTimer and CoGetApartmentType local. --- AUTHORS.rst | 1 + CHANGELOG.rst | 4 ++++ bleak/backends/winrt/util.py | 41 ++++++++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 3526f0dd..b6eca00d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -23,6 +23,7 @@ Contributors * Robbe Gaeremynck * David Johansen * JP Hutchins +* Bram Duvigneau Sponsors -------- diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c2d9b43c..ab51b831 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,10 @@ and this project adheres to `Semantic Versioning