Skip to content
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

gh-111089: Add cache to PyUnicode_AsUTF8() for embedded NUL #111587

Closed
wants to merge 9 commits into from

Commits on Nov 1, 2023

  1. pythongh-111089: Add cache to PyUnicode_AsUTF8() for embedded NUL

    Add PyASCIIObject.state.embed_null member to Python str objects. It
    is used as a cache by PyUnicode_AsUTF8() to only check once if a
    string contains a null character. Strings created by
    PyUnicode_FromString() initializes *embed_null* since the string
    cannot contain a null character.
    
    Global static strings now also initialize the *embed_null* member.
    The chr(0) singleton ("\0" string) is the only static string which
    contains a null character.
    vstinner committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    8004312 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a7e93c9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4ccd7d9 View commit details
    Browse the repository at this point in the history
  4. Add constant

    vstinner committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    3c4844f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e224751 View commit details
    Browse the repository at this point in the history
  6. Add What's New entry

    vstinner committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    65c6671 View commit details
    Browse the repository at this point in the history
  7. Make the fast path faster.

    Suggestion by Serhiy
    vstinner committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    30bb725 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    07975be View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2023

  1. Set embed_null in more cases on new strings

    * unicode_char()
    * PyUnicode_FromWideChar(str, -1)
    * _PyUnicode_Copy()
    vstinner committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    e3c6fa5 View commit details
    Browse the repository at this point in the history