bpo-32096: Statically initialize the default raw allocator.#4481
bpo-32096: Statically initialize the default raw allocator.#4481ericsnowcurrently wants to merge 5 commits intopython:masterfrom
Conversation
ncoghlan
left a comment
There was a problem hiding this comment.
In addition to a NEWS entry, it would be preferable to add an explicit test for this to _testembed.c.
Python/pylifecycle.c
Outdated
There was a problem hiding this comment.
Doubled word "before before" in the comment.
|
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 |
|
For the explicit test, I'd suggest a dedicated one that just does: We can then consider adding equivalent tests for other "safe before Py_Initialize" APIs in https://bugs.python.org/issue32086 |
a8c4376 to
9584720
Compare
ncoghlan
left a comment
There was a problem hiding this 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 :)
| have been crashing. This is because they rely on the raw memory allocator | ||
| having been initialized already. Before the runtime state change the | ||
| default raw allocator was initialized statically. This has now been fixed | ||
| by falling back to the defaults in PyMem_RawMalloc() and PyMem_RawFree(). |
There was a problem hiding this comment.
Should the last two names here have underscore prefixes?
|
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. |
|
This PR has been superseded by PR #4532, which reverts the mem-related globals consolidation. We will revisit a long-term solution later. |
The recent global runtime state consolidation broke pre-init usage of Py_DecodeLocale(). This patch fixes that.
https://bugs.python.org/issue32096