From 2fb9bd7d561b827851f4eddc6b90d6f31511eab3 Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 7 Jun 2026 13:36:17 +0900 Subject: [PATCH 1/2] test: skip tests using `util` on Python 3.15 alpha/beta. Temporarily skip tests relying on `util` when running on Python 3.15 alpha/beta versions, as recent layout changes cause a `RuntimeError` during import. --- comtypes/test/test_util.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/comtypes/test/test_util.py b/comtypes/test/test_util.py index db7348b1..f3398957 100644 --- a/comtypes/test/test_util.py +++ b/comtypes/test/test_util.py @@ -1,3 +1,4 @@ +import sys import unittest from ctypes import ( POINTER, @@ -13,7 +14,25 @@ sizeof, ) -import comtypes.util +PY_3_15_ALPHA_BETA = ( + sys.version_info.major == 3 + and sys.version_info.minor == 15 + and sys.version_info.releaselevel in ("alpha", "beta") +) + +try: + import comtypes.util +except RuntimeError as e: + SKIP_MSG = ( + "Starting from Python 3.15, layout is changed. " + "See https://github.com/enthought/comtypes/issues/938." + ) + if PY_3_15_ALPHA_BETA: + + def setUpModule(): + raise unittest.SkipTest(SKIP_MSG) + else: + raise e from comtypes import GUID, CoCreateInstance, IUnknown, shelllink From f1b280266290229492f982271f5d4da029a3553b Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 7 Jun 2026 13:44:23 +0900 Subject: [PATCH 2/2] test: clarify `SKIP_MSG` reason in `test_util.py` --- comtypes/test/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comtypes/test/test_util.py b/comtypes/test/test_util.py index f3398957..5e8f23aa 100644 --- a/comtypes/test/test_util.py +++ b/comtypes/test/test_util.py @@ -24,7 +24,7 @@ import comtypes.util except RuntimeError as e: SKIP_MSG = ( - "Starting from Python 3.15, layout is changed. " + "Starting from Python 3.15, PyCArgObject layout is changed. " "See https://github.com/enthought/comtypes/issues/938." ) if PY_3_15_ALPHA_BETA: