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-89653: PEP 670: Convert unicodeobject.h macros to functions#91705

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:unicode_macros1
Apr 21, 2022
Merged

gh-89653: PEP 670: Convert unicodeobject.h macros to functions#91705

vstinner merged 2 commits intopython:mainfromvstinner:unicode_macros1
Apr 21, 2022

Conversation

vstinner
Copy link
Member

Convert unicodeobject.h macros to static inline functions:

  • PyUnicode_CHECK_INTERNED()
  • PyUnicode_DATA(), _PyUnicode_COMPACT_DATA(),
    _PyUnicode_NONCOMPACT_DATA()
  • PyUnicode_GET_LENGTH()
  • PyUnicode_IS_ASCII()
  • PyUnicode_IS_COMPACT()
  • PyUnicode_IS_COMPACT_ASCII()
  • PyUnicode_IS_READY()

Reorder functions to declare functions before their first usage.

Static inline functions are wrapped into macros which casts
"PyObject*" with _PyObject_CAST() to prevent introducing new compiler
warnings when passing "const PyObject*".

@vstinner
Copy link
MemberAuthor

@erlend-aasland: Ok, here is a shorter PR.

I left the PyUnicode_KIND() macro unchanged since converting it to a static inline function introduces new compiler warning if the return type isint, but also if the return type isunsigned int! The compiler doesn't emit warnings on the macro, only with a static inline function.

Convert unicodeobject.h macros to static inline functions:* PyUnicode_CHECK_INTERNED()* PyUnicode_DATA(), _PyUnicode_COMPACT_DATA(),  _PyUnicode_NONCOMPACT_DATA()* PyUnicode_GET_LENGTH()* PyUnicode_IS_ASCII()* PyUnicode_IS_COMPACT()* PyUnicode_IS_COMPACT_ASCII()* PyUnicode_IS_READY()Reorder functions to declare functions before their first usage.Static inline functions are wrapped into macros which casts"PyObject*" with _PyObject_CAST() to prevent introducing new compilerwarnings when passing "const PyObject*".
Copy link
Contributor

@erlend-aaslanderlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good! I left some small nitpick comments.

@vstinnervstinner merged commit4e52c66 intopython:mainApr 21, 2022
@vstinnervstinner deleted the unicode_macros1 branchApril 21, 2022 00:51
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@erlend-aaslanderlend-aaslanderlend-aasland left review comments

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

Successfully merging this pull request may close these issues.

3 participants
@vstinner@erlend-aasland@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp