◐ Shell
reader mode source ↗
Skip to content

bpo-32096: Statically initialize the default raw allocator.#4481

Closed
ericsnowcurrently wants to merge 5 commits into
python:masterfrom
ericsnowcurrently:fix-32096
Closed

bpo-32096: Statically initialize the default raw allocator.#4481
ericsnowcurrently wants to merge 5 commits into
python:masterfrom
ericsnowcurrently:fix-32096

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Nov 20, 2017

Copy link
Copy Markdown
Member

The recent global runtime state consolidation broke pre-init usage of Py_DecodeLocale(). This patch fixes that.

https://bugs.python.org/issue32096

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

In addition to a NEWS entry, it would be preferable to add an explicit test for this to _testembed.c.

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ncoghlan

ncoghlan commented Nov 21, 2017

Copy link
Copy Markdown
Contributor

For the explicit test, I'd suggest a dedicated one that just does:

ptr = Py_DecodeLocale();
Py_Initialize();
Py_Finalize();
PyMem_RawFree(ptr);

We can then consider adding equivalent tests for other "safe before Py_Initialize" APIs in https://bugs.python.org/issue32086

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

This looks good to me, but I'm not entirely sure I understand the NEWS entry.

Unless the NEWS entry has typos in it, in which case it makes sense and just needs the typos fixed :)

@ncoghlan

Copy link
Copy Markdown
Contributor

CI failure looks real though - my guess would be an allocator/deallocator mismatch due to Py_Finalize not explicitly reverting back to the default allocator.

@ericsnowcurrently

Copy link
Copy Markdown
Member Author

This PR has been superseded by PR #4532, which reverts the mem-related globals consolidation. We will revisit a long-term solution later.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants