Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Jan 10, 2026

Closes #898

This pull request introduces a module for IMalloc (memory allocation) and enhances related testing.

Features

  • Introduced malloc.py: A new module providing the IMalloc interface definition and core memory allocation/deallocation function declarations.
  • Added Type Hints for IMalloc methods: Incorporated TYPE_CHECKING blocks within malloc.py to provide static type hints for IMalloc methods.

@junkmd junkmd added this to the 1.4.15 milestone Jan 10, 2026
@junkmd junkmd added the enhancement New feature or request label Jan 10, 2026
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.61%. Comparing base (baef773) to head (8830f97).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #899      +/-   ##
==========================================
+ Coverage   85.49%   85.61%   +0.11%     
==========================================
  Files         128      128              
  Lines       12060    12074      +14     
==========================================
+ Hits        10311    10337      +26     
+ Misses       1749     1737      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@junkmd junkmd changed the title Introduce IMalloc module and enhance COM memory management tests. Introduce malloc module and enhance COM memory management tests. Jan 10, 2026
Introduces `comtypes/test/test_malloc.py` to provide test coverage
for the `IMalloc.Realloc` method, ensuring proper memory
reallocation behavior.
Introduces `test_SHGetKnownFolderPath` in `test_malloc.py` to verify the
correct functionality of `SHGetKnownFolderPath` and its interaction with
memory allocation and deallocation via `IMalloc`.
Moves the import of `_CoTaskMemFree` from `GUID.py` to `malloc.py`.
Introduces a `TYPE_CHECKING` block within `malloc.py` to provide static type
hints for the methods of the `IMalloc` interface.
…behavior.

`Realloc` can perform in-place re-allocations, which would result in `DidAlloc`
returning `1` for the original pointer.
@junkmd junkmd force-pushed the add_malloc_module branch from 00aa48c to 8830f97 Compare January 10, 2026 12:26
@junkmd junkmd merged commit 8c3bdec into enthought:main Jan 10, 2026
165 of 199 checks passed
@junkmd junkmd deleted the add_malloc_module branch January 10, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Add comtypes.malloc module and define IMalloc interface

1 participant