-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-100926: Move ctype's pointers cache to StgInfo #131282
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
Merged
encukou
merged 77 commits into
python:main
from
sergey-miryanov:gh-100926-ctypes-pointers-cache
May 2, 2025
Merged
Changes from 10 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
87a974b
Move ctype's pointers cache to StgInfo
sergey-miryanov 12600a6
Fix PyCStgInfo_clone for pointer_type
sergey-miryanov 2b0d69f
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov df2167a
No need to use _ctypes_ptrtype_cache for create_pointer_inst
sergey-miryanov f96ae59
Remove unused st from create_pointer_inst
sergey-miryanov 481cf59
It is better to check local cache first
sergey-miryanov 96b4dd1
Update Modules/_ctypes/callproc.c
sergey-miryanov 4fb5baa
Update Modules/_ctypes/callproc.c
sergey-miryanov 758045f
Add news and whatsnew entries
sergey-miryanov 2f9285f
Update Modules/_ctypes/_ctypes.c
sergey-miryanov b070ad5
Arrange pointer_type declaration
sergey-miryanov ef1e633
Use assertIs to check pointer types in tests
sergey-miryanov 6ea410d
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov 3754d3d
Implement pointer-type creation via __pointer_type__
sergey-miryanov 10e36e4
Fix _CType_Type
sergey-miryanov 29bfe9c
Update Lib/test/test_ctypes/test_c_simple_type_meta.py
sergey-miryanov f8139ff
Fix POINTER and test_creating_pointer_in_dunder_new_1
sergey-miryanov e1aaf45
Do not share pointer_type via StgInfo clone
sergey-miryanov 82f74ec
Test if PyCStgInfo_clone not share pointer_type cache
sergey-miryanov eacc724
Simplify POINTER
sergey-miryanov 0b373d5
Add some extra checks and tests
sergey-miryanov 9c49abd
Fix tests for ct_meta with init
sergey-miryanov 3c38aa5
Do not use Py_XSETREF if dst already NULL
sergey-miryanov efd4961
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov e251a7d
Add docstrings for POINTER and pointer
sergey-miryanov cdba1f6
Remove import of c-versions of POINTER and pointer
sergey-miryanov a241cd9
Remove c-versions of POINTER and pointer
sergey-miryanov 8d85624
Remove c-versions of _pointer_type_cache/_ctypes_ptrtype_cache
sergey-miryanov aedc4b2
Add extra test for set_type/PyCPointerType_SetProto
sergey-miryanov 6ac84c7
Add test for creating types with factory
sergey-miryanov 2373c63
Fix docstrings
sergey-miryanov fc93bc8
Add some tests for pointer
sergey-miryanov 5768347
Update news and whatsnew
sergey-miryanov a2cff24
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov 87f8cf3
Fix tests
sergey-miryanov 5b9891f
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov 85ff1a0
Add few more tests
sergey-miryanov d11af80
Add some more tests
sergey-miryanov 6dd1e1a
Update docs
sergey-miryanov 33ae038
Update news
sergey-miryanov 08bdada
Fix news
sergey-miryanov 8505d4b
Add some more tests
sergey-miryanov c1bf7cc
Add more tests for metabases pointers
sergey-miryanov ea0bf20
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov fc3bc33
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov 62d2deb
Try to add thread safety to pointer_type
sergey-miryanov 360303f
Revert "Try to add thread safety to pointer_type"
sergey-miryanov a2cc961
Add set_non_ctypes_pointer_type
sergey-miryanov df56541
Add some new test and docstrings for tests
sergey-miryanov 283bf96
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov 7d42666
Address some neonene comments
sergey-miryanov 0bb389e
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov e31c7e9
Move __pointer_type__ docs to common class variables section
sergey-miryanov 56d41e2
Apply suggestions from code review
sergey-miryanov 4316ad9
Remove Pointers for ctypes-like types section
sergey-miryanov 9c99f9c
Update news entry
sergey-miryanov 5753fc9
Update docstring for POINTER and add comments
sergey-miryanov 58a1507
Implement _pointer_type_cache as PointerTypeCache proxy
sergey-miryanov 7082009
Raise AttributeError if __pointer_type__ is not set
sergey-miryanov f89da96
Fixed POINTER if __pointer_type__ already initialized
sergey-miryanov 1afa7b3
Fixed default value for PointerTypeCache.get
sergey-miryanov e99277c
Remove setting item in _pointer_type_cache from SetPointerType
sergey-miryanov ebed23e
tests: Remove teardown code that now does nothing
encukou c4ee75a
Remove _pointer_type_cache setting
encukou 66c68b0
Handle old-style incomplete types
encukou 0d2c75b
Document deprecations
encukou 8597f6b
Allow setting/deleting __pointer_type__
encukou 0b5de27
Allow arbitrary set_type as before
encukou 78b6c15
Apply suggestions from code review
sergey-miryanov dfd529c
Merge encukou seggestions from PR
sergey-miryanov 2fc600b
Fix typos in test_pointer_set_wrong_type test
sergey-miryanov cb78a03
set_pointer for type should reset type cache
sergey-miryanov 4ef57e9
Merge branch 'main' into gh-100926-ctypes-pointers-cache
sergey-miryanov b33890d
get and getitem should consistent
sergey-miryanov 0acc2b2
Merge branch 'main' into gh-100926-ctypes-pointers-cache
encukou 3129ef5
Wording tweak
encukou 8efa28a
Apply suggestions from code review
encukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2025-03-17-23-07-57.gh-issue-100926.B8gcbz.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Move :func:`ctypes.POINTER` types cache from the global ``_pointer_type_cache`` | ||
to the corresponding :mod:`ctypes` types to avoid unlimited growth of the cache. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.