gh-125783: Add tests to prevent regressions with the combination of `ctypes` and metaclasses.
I would like to backport this to 3.12 and 3.13 as well.
- Issue: gh-125783
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.
If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.
This is an internal-only change, I don't think it needs a NEWS entry.
comtypes has been using _pointer_type_cache since the first commit (an impressive 18 years ago!).
https://github.com/enthought/comtypes/blob/938fbd50d2077c6bd524790a9ed798c3990cdfc0/comtypes/init.py#L230-L231
This was also discussed in #125783, and it seems that these implementations were made with careful consideration, as the originator of both comtypes and ctypes is the same person.
I plan to commit the suggestions and merge next week, if there are no objections.
Can we apply needs backport to 3.12 and needs backport to 3.13 labels to this PR?
I'm not sure if we backport increased test coverage.
We generally do, mostly to make it easier to backport later changes that need tests.
Thanks @junkmd for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. 🐍🍒⛏🤖
GH-125987 is a backport of this pull request to the 3.13 branch.
GH-125988 is a backport of this pull request to the 3.12 branch.