GeezerVison is showing github.com — gh-106320: Remove private _PyDict function by vstinner · Pull Request #108449 · python/cpython
Conversation
vstinner
commented
Aug 24, 2023
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Move private _PyDict functions to the internal C API (pycore_dict.h):
- _PyDictView_Intersect()
- _PyDictView_New()
- _PyDict_ContainsId()
- _PyDict_DelItemId()
- _PyDict_DelItem_KnownHash()
- _PyDict_GetItemIdWithError()
- _PyDict_GetItem_KnownHash()
- _PyDict_HasSplitTable()
- _PyDict_NewPresized()
- _PyDict_Next()
- _PyDict_Pop()
- _PyDict_SetItemId()
- _PyDict_SetItem_KnownHash()
- _PyDict_SizeOf()
No longer export most of these functions.
Move also the _PyDictViewObject to the internal C API.
Move dict_getitem_knownhash() function from _testcapi to the _testinternalcapi extension. Update test_capi.test_dict for this move.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Bobronium reacted with eyes emoji
Move private _PyDict functions to the internal C API (pycore_dict.h):
* _PyDictView_Intersect()
* _PyDictView_New()
* _PyDict_ContainsId()
* _PyDict_DelItemId()
* _PyDict_DelItem_KnownHash()
* _PyDict_GetItemIdWithError()
* _PyDict_GetItem_KnownHash()
* _PyDict_HasSplitTable()
* _PyDict_NewPresized()
* _PyDict_Next()
* _PyDict_Pop()
* _PyDict_SetItemId()
* _PyDict_SetItem_KnownHash()
* _PyDict_SizeOf()
No longer export most of these functions.
Move also the _PyDictViewObject to the internal C API.
Move dict_getitem_knownhash() function from _testcapi to the
_testinternalcapi extension. Update test_capi.test_dict for this
move.
|
@vstinner In this PR the method _PyDict_NewPresized was moved to the internal API. According to https://devguide.python.org/developer-workflow/c-api/#with-the-extern-keyword the method should still be available for stdlib extensions.
I am using the method in an extension module #91610, but the build is failing since this PR was merged with error message Error: _copy failed to import: /home/runner/work/cpython/cpython-builddir/build/lib.linux-x86_64-3.13-pydebug/_copy.cpython-313d-x86_64-linux-gnu.so: undefined symbol: _PyDict_NewPresized (but the build is successful for Windows platforms).
I added the correct header file #include "pycore_dict.h" and macros Py_BUILD_CORE_MODULE and Py_BUILD_CORE_BUILTIN. What else needs to be done to make use of _PyDict_NewPresized?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I am using the method in an extension module #91610, but the build is failing since this PR was merged with error message Error: _copy failed to import: /home/runner/work/cpython/cpython-builddir/build/lib.linux-x86_64-3.13-pydebug/_copy.cpython-313d-x86_64-linux-gnu.so: undefined symbol: _PyDict_NewPresized (but the build is successful for Windows platforms).
If you want to use this function in a stdlib extension, you should replace extern with PyAPI_FUNC(). It's required to be able to use the function in extensions built as shared libraries.
|
eendebakpt reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 24, 2023
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|