Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106320: Remove private _PyDict function#108449

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 2 commits intopython:mainfromvstinner:pycore_dict2
Aug 24, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedAug 24, 2023
edited by bedevere-bot
Loading

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.

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 thismove.
@vstinnervstinnerenabled auto-merge (squash)August 24, 2023 19:38
@vstinnervstinner merged commit2689301 intopython:mainAug 24, 2023
@vstinnervstinner deleted the pycore_dict2 branchAugust 24, 2023 23:23
@eendebakpt
Copy link
Contributor

@vstinner In this PR the method_PyDict_NewPresized was moved to the internal API. According tohttps://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 messageError: _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 macrosPy_BUILD_CORE_MODULE andPy_BUILD_CORE_BUILTIN. What else needs to be done to make use of_PyDict_NewPresized?

@vstinner
Copy link
MemberAuthor

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 replaceextern withPyAPI_FUNC(). It's required to be able to use the function in extensions built asshared libraries.

eendebakpt reacted with thumbs up emoji

scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
scoder added a commit to scoder/cpython that referenced this pull requestOct 24, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rhettingerrhettingerAwaiting requested review from rhettingerrhettinger is a code owner

@kumaraditya303kumaraditya303Awaiting requested review from kumaraditya303kumaraditya303 is a code owner

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

@gvanrossumgvanrossumAwaiting requested review from gvanrossum

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@vstinner@eendebakpt@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp