Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Jul 9, 2025

Fixes #858

@junkmd junkmd added bug Something isn't working tests enhance or fix tests labels Jul 9, 2025
@codecov
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.74%. Comparing base (6a580b3) to head (514f052).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #857      +/-   ##
==========================================
- Coverage   84.75%   84.74%   -0.01%     
==========================================
  Files         125      125              
  Lines       11571    11566       -5     
==========================================
- Hits         9807     9802       -5     
  Misses       1764     1764              

☔ 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 force-pushed the fix_npsupport_2x_explicit_dtype branch from 26122b2 to 3f47e0a Compare July 9, 2025 14:35
@junkmd junkmd changed the title Fix VT_I4 ndarray creation with explicitly specifying dtype=numpy.int32. Modernize npsupport. Jul 11, 2025
@junkmd junkmd force-pushed the fix_npsupport_2x_explicit_dtype branch 4 times, most recently from 7db5339 to a5f6c25 Compare July 17, 2025 23:37
@junkmd junkmd force-pushed the fix_npsupport_2x_explicit_dtype branch 2 times, most recently from ece1978 to 9887a10 Compare July 27, 2025 00:17
@junkmd
Copy link
Collaborator Author

junkmd commented Jul 27, 2025

This PR focuses solely on removing the patch for the _typecodes mapping that existed in older NumPy versions, as discussed in #216 (comment).

To verify that the mapping elements remain unchanged, simply run the following in interactive mode both before and after code modifications.

>>> import comtypes
>>> comtypes.npsupport.enable()
>>> for k, v in comtypes.npsupport.typecodes.items():
...     k, v
... 
('|i1', <class 'ctypes.c_byte'>)
('|u1', <class 'ctypes.c_ubyte'>)
('<f4', <class 'ctypes.c_float'>)
('<i2', <class 'ctypes.c_short'>)
('<u2', <class 'ctypes.c_ushort'>)
('<f8', <class 'ctypes.c_double'>)
('<i4', <class 'ctypes.c_long'>)
('<u4', <class 'ctypes.c_ulong'>)
('|b1', <class 'ctypes.c_bool'>)
('<i8', <class 'ctypes.c_longlong'>)
('<u8', <class 'ctypes.c_ulonglong'>)

@junkmd junkmd changed the title Modernize npsupport. Modernize npsupport by removing the patch for the np._typecodes. Jul 27, 2025
junkmd added 2 commits July 27, 2025 10:17
Rename from `_check_ctypeslib_typecodes` to `_build_typecodes` for
clarity.
Remove overwriting `ctypeslib._typecodes` because `_typecodes` was
removed in `numpy==1.16` (`numpy` supporting Python3.8 is `1.17`
and above).
@junkmd junkmd force-pushed the fix_npsupport_2x_explicit_dtype branch from 9887a10 to 514f052 Compare July 27, 2025 01:18
@junkmd
Copy link
Collaborator Author

junkmd commented Jul 27, 2025

Codecov observed only a -0.01% decrease in coverage with this change.
This is likely just because we're not covering branches where npsupport isn't enabled.

514f052
https://app.codecov.io/gh/enthought/comtypes/commit/514f052094a08b51599bde9158ac21063c6c4c91

@junkmd junkmd marked this pull request as ready for review July 27, 2025 01:43
@junkmd junkmd merged commit 5c564ec into enthought:main Jul 27, 2025
52 checks passed
@junkmd junkmd deleted the fix_npsupport_2x_explicit_dtype branch July 27, 2025 01:45
@junkmd junkmd added this to the 1.4.12 milestone Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working npsupport tests enhance or fix tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npsupport relies on private numpy.ctypeslib APIs and patches or overwrites NumPy's internal implementations.

1 participant