Introduce warnings for Python 3.15 enum compatibility and improve test stability.#907
Merged
junkmd merged 4 commits intoenthought:mainfrom Jan 19, 2026
Merged
Conversation
Explain that `IntFlag` values for negative enum members may be reinterpreted in Python 3.15+, affecting `comtypes` generated enums.
Introduces a `FutureWarning` in `__init__.py` for Python 3.15 and later to notify users about potential changes in `enum` handling, specifically `IntFlag` values.
Conditionally skip `test_enums_in_friendly_mod` on Python 3.15 alpha/beta versions in `test_client.py` to prevent failures due to potential `IntFlag` changes. This change includes adding `subTest` messages for better debugging. Additionally, refactor enum member access in `test_puredispatch.py` from `msi.MsiInstallState.msiInstallStateUnknown` to `msi.msiInstallStateUnknown` for improved clarity and consistency.
The test now uses `create_unicode_buffer` to safely allocate a valid memory block outside of the COM allocator's control. This ensures the test correctly validates the behavior of `from_outparam` on unmanaged memory without causing access violations.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #907 +/- ##
==========================================
- Coverage 86.26% 86.24% -0.02%
==========================================
Files 132 132
Lines 12326 12334 +8
==========================================
+ Hits 10633 10638 +5
- Misses 1693 1696 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Overview
This pull request is focusing on the introduction of warnings regarding Python 3.15 compatibility, enhancement of existing test stability, and prevention of potential errors in memory-related tests.
Warnings for Python 3.15
enumBehavior ChangesTo address the upcoming changes in
IntFlaghandling in Python 3.15, introducing aFutureWarningto proactively notify users of potential behavioral shifts.An initial explanation of this change has also been added to
README.md.Test Assertions in
test_puredispatch.pyIn
test_puredispatch.py, test assertions for theProductStateproperty now directly use module-level constants.This is a measure to avoid being affected by the reinterpretation of
IntFlagin Python 3.15.Skipping Tests in Python 3.15 Alpha/Beta
To prevent CI failures caused by known but unfinalized changes in Python 3.15's alpha and beta versions, specific tests related to
enumbehavior are now conditionally skipped.This allows the CI pipeline to remain green, preventing new, unrelated bugs from being obscured.
This skipping mechanism is intended as a temporary measure until Python 3.15 reaches a Release Candidate (RC) stage, at which point these tests will be unskipped to ensure full compatibility validation for the final release.
Ensuring Memory Safety in
from_outparamTestsThe
test_outparammodule has been updated to prevent potential memory-related inconsistency.By using
create_unicode_buffer, the tests can safely verify the behavior offrom_outparamon memory outside of the COM allocator's control.