Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Jan 18, 2026

This pull request introduces the usable ITypeInfo.AddressOfMember method, enabling developers to retrieve the memory addresses of static functions and variables within COM objects.

While the high-level wrapper has existed since the project's inception, it was effectively unusable as it always raised an error when called—a fact consistent across its entire project Git history.
Now, after nearly 20 years, it is finally functional.

This capability is crucial for advanced interoperability scenarios where direct memory access to COM object members is required, opening up new possibilities for low-level integration and performance optimizations.

The accompanying comprehensive test suite for ITypeInfo.AddressOfMember (test_typeinfo.py) ensures the reliability and correctness of this new functionality. These tests go beyond basic validation by specifically verifying:

  • Module Type Information: It demonstrates the ability to extract type attributes (cImplTypes, typekind) for modules, which was previously an uncovered area.
  • DLL Entry Point Resolution: The tests validate the GetDllEntry method's ability to accurately resolve the exported DLL name, function name, and ordinal.
  • Memory Address Retrieval: By comparing the address obtained through AddressOfMember with a dynamically resolved function address, the tests confirm that AddressOfMember provides accurate and actionable memory locations.
  • Clarity and Maintainability: The tests and the implementation of ITypeInfo.AddressOfMember include extensive comments and type hints.

…test.

Implements the `ITypeInfo.AddressOfMember` method to support retrieving
addresses of static functions and variables. This allows access to
member addresses of COM objects. Type hints and tests have also been added.
Adds comments to the `test_module_ITypeInfo` to clarify the usage of
`stdole2.tlb` and provide an alternative method for obtaining typeinfo.
Adds assertions for `tattr.cImplTypes` and `tattr.typekind` within the
`test_module_ITypeInfo`.
Adds assertions to verify the `dll_name`, `func_name`, and `ordinal`
returned by `tinfo.GetDllEntry`. Also includes clarifying comments
regarding the behavior of `GetDllEntry` and the `stdole2.tlb`
component.
@junkmd junkmd added this to the 1.4.15 milestone Jan 18, 2026
@junkmd junkmd added bug Something isn't working enhancement New feature or request tests enhance or fix tests typing related to Python static typing system debt labels Jan 18, 2026
@codecov
Copy link

codecov bot commented Jan 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (921b699) to head (815034c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #905      +/-   ##
==========================================
+ Coverage   86.06%   86.11%   +0.05%     
==========================================
  Files         132      132              
  Lines       12270    12288      +18     
==========================================
+ Hits        10560    10582      +22     
+ Misses       1710     1706       -4     

☔ 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 merged commit 1aab6ae into enthought:main Jan 18, 2026
93 of 101 checks passed
@junkmd junkmd deleted the typeinfo_address_of_members branch January 18, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working debt enhancement New feature or request tests enhance or fix tests typing related to Python static typing system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant