GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — unicode: make ucnhash_capi initialization thread-safe in `--disable-gil` builds · Issue #111972 · python/cpython

unicode: make ucnhash_capi initialization thread-safe in --disable-gil builds #111972

New issue
Copy link
New issue
Copy link
Closed
#112249
Closed
unicode: make ucnhash_capi initialization thread-safe in --disable-gil builds#111972
#112249
Copy link
Assignees
Eclips4
Labels
3.13only security fixesonly security fixestopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Description

@colesbury
colesbury
opened on Nov 10, 2023
Issue body actions

Feature or enhancement

The _PyUnicode_Name_CAPI provides functions to get the name for a given Unicode character code and vice versa. It is lazily initialized and stored in the per-interpreter _Py_unicode_state:

cpython/Include/internal/pycore_unicodeobject.h

Lines 425 to 432 in 3932b0f

struct _Py_unicode_state {
struct _Py_unicode_fs_codec fs_codec;
_PyUnicode_Name_CAPI *ucnhash_capi;
// Unicode identifiers (_Py_Identifier): see _PyUnicode_FromId()
struct _Py_unicode_ids ids;
};

The initialization of the ucnhash_capi isn't thread-safe without the GIL. (There can be a data race on reading and writing ucnhash_capi).

Mostly for my own reference, here are the similar modifications in the nogil-3.12 fork: colesbury/nogil-3.12@5d006db9fa

Linked PRs

  • gh-111972: unicode: Make ucnhash_capicapsule initialization thread-safe #112249

Activity

  1. colesbury
    added
    type-featureA feature request or enhancementA feature request or enhancement
    3.13only security fixesonly security fixes
    topic-free-threading
    on Nov 10, 2023
  2. Eclips4
    added a commit that references this issue on Nov 18, 2023

    pythongh-111972: Make ucnhash_capi initialization thread-safe

    0022adc
  3. Eclips4 commented on Nov 18, 2023

    @Eclips4
    Eclips4
    on Nov 18, 2023
    Member
    More actions

    This seems quite easy 😄
    Please, take a look at the #112249.

    Reacted by Sam Gross
  4. Eclips4
    self-assigned this
    on Nov 18, 2023
  5. erlend-aasland
    added a commit that references this issue on Nov 30, 2023

    gh-111972: Make Unicode name C APIcapsule initialization thread-safe (#…

    0785c68
  6. erlend-aasland commented on Nov 30, 2023

    @erlend-aasland
    erlend-aasland
    on Nov 30, 2023
    Contributor
    More actions

    Resolved by #112249

  7. erlend-aasland
    closed this as completedon Nov 30, 2023
  8. erlend-aasland
    linked a pull request that will close this issuegh-111972: unicode: Make `ucnhash_capi`capsule initialization thread-safe #112249on Nov 30, 2023
  9. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-111972: Make Unicode name C APIcapsule initialization thread…

    916c247
  10. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-111972: Make Unicode name C APIcapsule initialization thread…

    d4d2dbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Eclips4
    Eclips4

Labels

3.13only security fixesonly security fixestopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.