-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-125783: Add tests to prevent regressions with the combination of ctypes
and metaclasses.
#125881
Conversation
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 |
This is an internal-only change, I don't think it needs a NEWS entry. |
Such an implementation is used in `IUnknown` of `comtypes`.
Such an implementation is used in `CoClass` of `comtypes`.
1f4eecd
to
cf81f03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really rather not use _
in local names here, it makes it unclear that we're testing something public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Take my review as provisional--I am concerned about the use of _pointer_type_cache
, as that's private, but it looks like it's not terribly abused in this case (I think?)
This was also discussed in #125783, and it seems that these implementations were made with careful consideration, as the originator of both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the test! I'd only like to change the names and add some comments.
The main thing we're testing here instantiation of a class in its own __new__
, not the early return, that's there to avoid recursion.
I plan to commit the suggestions and merge next week, if there are no objections. |
Co-authored-by: Petr Viktorin <[email protected]>
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. |
…n of `ctypes` and metaclasses. (pythonGH-125881) (cherry picked from commit 1384409) Co-authored-by: Jun Komoda <[email protected]>
…n of `ctypes` and metaclasses. (pythonGH-125881) (cherry picked from commit 1384409) Co-authored-by: Jun Komoda <[email protected]>
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. |
…on of `ctypes` and metaclasses. (GH-125881) (GH-125988) cherry picked from commit 1384409 by Jun Komoda Also: Add test_ctypes/_support.py from 3.13+ This partially backports be89ee5 (#113727) by AN Long Co-authored-by: Jun Komoda <[email protected]> Co-authored-by: AN Long <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]>
I would like to backport this to 3.12 and 3.13 as well.
ctypes
and metaclasses. #125783