Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged #24193

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

Merged
merged 1 commit into from
Jan 12, 2021
Merged

bpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged #24193

merged 1 commit into from
Jan 12, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 11, 2021

Fix the _PyUnicode_FromId() function (_Py_IDENTIFIER(var) API) when
Py_Initialize() / Py_Finalize() is called multiple times:
preserve _PyRuntime.unicode_ids.next_index value.

Use _PyRuntimeState_INIT macro instead memset(0) to reset
_PyRuntimeState members to zero.

https://bugs.python.org/issue42882

Fix the _PyUnicode_FromId() function (_Py_IDENTIFIER(var) API) when
Py_Initialize() / Py_Finalize() is called multiple times:
preserve _PyRuntime.unicode_ids.next_index value.

Use _PyRuntimeState_INIT macro instead memset(0) to reset
_PyRuntimeState members to zero.
Copy link
Contributor

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

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

This seems to fix pybind/pybind11#2774 (in local Linux builds, at least). Thanks!

@vstinner vstinner merged commit 44bf57a into python:master Jan 12, 2021
@vstinner vstinner deleted the unicode_next_index branch January 12, 2021 09:29
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…pythonGH-24193)

Fix the _PyUnicode_FromId() function (_Py_IDENTIFIER(var) API) when
Py_Initialize() / Py_Finalize() is called multiple times:
preserve _PyRuntime.unicode_ids.next_index value.

Use _PyRuntimeState_INIT macro instead memset(0) to reset
_PyRuntimeState members to zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants