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 _PyLong_IsCompact() function#108742

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

Closed

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedSep 1, 2023
edited by github-actionsbot
Loading

Move the private _PyLong_IsCompact() and _PyLong_CompactValue() functions to the internal C API (pycore_long.h). Public PyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue() functions can be used instead.

Remove "const" qualifier from PyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue() parameter type.


📚 Documentation preview 📚:https://cpython-previews--108742.org.readthedocs.build/

@vstinner
Copy link
MemberAuthor

With this change, PyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue() become regular opaque function calls. They are no longer implemented as static inline functions. That's needed to be able remove the 2 associated static inline functions from the public C API.

Remove "const" qualifier from PyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue() parameter type.

When I tried to use theconst qualified in the public C API in the past, I had issues :-( I prefer to avoid it. For the internal C API with static inline functions, that's fine.

See:

Move the private _PyLong_IsCompact() and _PyLong_CompactValue()functions to the internal C API (pycore_long.h). PublicPyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue()functions can be used instead.Remove "const" qualifier from PyUnstable_Long_IsCompact() andPyUnstable_Long_CompactValue() parameter type.
@vstinnervstinner added the needs backport to 3.12only security fixes labelSep 1, 2023
@vstinner
Copy link
MemberAuthor

@gvanrossum@markshannon: Are the private _PyLong_IsCompact() and _PyLong_CompactValue() functions exposed by<Python.h> on purpose? Or are you are ok to move them to theinternal C API?

I don't know the impact on performance. I'm more in favor ofhiding implementation details.

If these functions are moved to the internal C API, are you ok to also make this change in Python 3.12?

Remove "const" qualifier from PyUnstable_Long_IsCompact() and PyUnstable_Long_CompactValue() parameter type.

I don't have a strong opinion on that, I'm also fine with keeping const if you prefer :-) It's just that in the past, I tried to useconst in the public C API and "I got issues".

@gvanrossum
Copy link
Member

Please don’t touch these. They are meant to be exported.

@gvanrossum
Copy link
Member

Also it’s too late for 3.12.

@vstinner
Copy link
MemberAuthor

Please don’t touch these. They are meant to be exported.

Ok, let's keep them.

@vstinnervstinner deleted the remove_pylong_iscompat branchSeptember 1, 2023 15:04
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@vstinner@gvanrossum@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp