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 — gh-111972: unicode: Make `ucnhash_capi`capsule initialization thread-safe by Eclips4 · Pull Request #112249 · python/cpython

Conversation

@Eclips4

@Eclips4 Eclips4 commented Nov 18, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: unicode: make ucnhash_capi initialization thread-safe in --disable-gil builds #111972

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Eclips4
pythongh-111972: Make ucnhash_capi initialization thread-safe
0022adc
@Eclips4 Eclips4 added the topic-free-threading label Nov 18, 2023
@Eclips4
Eclips4 requested a review from colesbury November 18, 2023 22:51
@bedevere-app bedevere-app Bot added the awaiting review label Nov 18, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Nov 18, 2023
unicode: make ucnhash_capi initialization thread-safe in --disable-gil builds #111972
Closed
@Eclips4 Eclips4 added the skip news label Nov 18, 2023
colesbury
colesbury reviewed Nov 19, 2023
View reviewed changes

@colesbury colesbury left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think we also need to handle the case 'N' in _PyUnicode_DecodeUnicodeEscapeInternal.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/codecs.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Eclips4
Address review
06111d7
@Eclips4

Eclips4 commented Nov 19, 2023

Copy link
Copy Markdown
Member Author

Should we do something with _PyUnicode_Fini?

cpython/Objects/unicodeobject.c

Lines 15445 to 15460 in 14fd86a

void
_PyUnicode_Fini(PyInterpreterState *interp)
{
struct _Py_unicode_state *state = &interp->unicode;
// _PyUnicode_ClearInterned() must be called before _PyUnicode_Fini()
assert(get_interned_dict(interp) == NULL);
_PyUnicode_FiniEncodings(&state->fs_codec);
// bpo-47182: force a unicodedata CAPI capsule re-import on
// subsequent initialization of interpreter.
interp->unicode.ucnhash_capi = NULL;
unicode_clear_identifiers(state);
}

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Eclips4 added 2 commits November 19, 2023 09:53
@Eclips4
Remove unused variable
ca5b5b6
@Eclips4
Fix test
6e2dbbd
@corona10
corona10 requested a review from erlend-aasland November 19, 2023 08:26
colesbury
colesbury reviewed Nov 20, 2023
View reviewed changes

@colesbury colesbury left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

_PyUnicode_Fini looks fine. I don't think it needs any special handling.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_unicodedata.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Eclips4 added 2 commits November 20, 2023 08:55
@Eclips4
Restore previous behaviour
4102839
@Eclips4
Fix indent
bfbb393
colesbury
colesbury approved these changes Nov 20, 2023
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Nov 20, 2023
@colesbury

colesbury commented Nov 29, 2023

Copy link
Copy Markdown
Contributor

@erlend-aasland, would you please review this when you get a chance?

erlend-aasland reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland approved these changes Nov 30, 2023
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Nov 30, 2023
@erlend-aasland
erlend-aasland merged commit 0785c68 into python:main Nov 30, 2023
@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 30, 2023
@erlend-aasland

erlend-aasland commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

Thanks for the PR, Kirill, and thanks for the review, Sam!

Eclips4 reacted with heart emoji Eclips4 and efimov-mikhail reacted with rocket emoji
All reactions
  • ❤️ 1 reaction
  • 🚀 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland erlend-aasland linked an issue Nov 30, 2023 that may be closed by this pull request
unicode: make ucnhash_capi initialization thread-safe in --disable-gil builds #111972
Closed
@Eclips4
Eclips4 deleted the issue-111972 branch November 30, 2023 10:15
vstinner
vstinner reviewed Nov 30, 2023
View reviewed changes
Comment thread Objects/unicodeobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@Eclips4 @aisk
pythongh-111972: Make Unicode name C APIcapsule initialization thread…
916c247
…-safe (python#112249)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@Eclips4 @Glyphack
pythongh-111972: Make Unicode name C APIcapsule initialization thread…
d4d2dbb
…-safe (python#112249)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@erlend-aasland erlend-aasland erlend-aasland approved these changes
@colesbury colesbury colesbury approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news topic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Eclips4 @colesbury @erlend-aasland @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — 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.