Skip to content

Commit 9f3d506

Browse files
authored
gh-159111: Add missing downstream changes when upgrade to 2.5.2. (gh-160207)
1 parent c58b713 commit 9f3d506

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎Doc/whatsnew/3.16.rst‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,11 +1295,6 @@ Build changes
12951295

12961296
(Contributed by Stan Ulbrych, Florian Mayer and AnnaAr321 in :gh:`156049`.)
12971297

1298-
* Update the bundled `mimalloc library`_ from version 2.1.2 to 2.5.2.
1299-
(Contributed by Donghee Na in :gh:`159111`.)
1300-
1301-
.. _mimalloc library: https://github.com/microsoft/mimalloc/
1302-
13031298

13041299
C API changes
13051300
=============

‎Include/internal/mimalloc/mimalloc/internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ terms of the MIT license. A copy of the license can be found in the file
102102
#define mi_decl_externc
103103
#endif
104104

105+
// CPython: upstream defines __wasi__ on Emscripten here. It is removed so that
106+
// CPython code can distinguish the two platforms (gh-158628).
105107

106108
// --------------------------------------------------------------------------
107109
// Internal functions

‎Objects/mimalloc/os.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ static void* mi_os_prim_alloc_aligned(size_t size, size_t alignment, bool commit
276276
else {
277277
// if not aligned, free it, overallocate, and unmap around it
278278
#if !MI_TRACK_ASAN
279+
// CPython: downgraded from _mi_warning_message, the warning is noisy in the test suite (gh-112027)
279280
_mi_verbose_message("unable to allocate aligned OS memory directly, fall back to over-allocation (size: 0x%zx bytes, address: %p, alignment: 0x%zx, commit: %d)\n", size, p, alignment, commit);
280281
#endif
281282
if (p != NULL) { mi_os_prim_free(p, size, (commit ? size : 0)); }

‎Objects/mimalloc/prim/unix/prim.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static bool unix_detect_overcommit(void) {
124124
#if defined(__linux__)
125125
int fd = mi_prim_open("/proc/sys/vm/overcommit_memory", O_RDONLY);
126126
if (fd >= 0) {
127-
char buf[32] = {0};
127+
char buf[32] = {0}; // CPython: zero-initialize to avoid an MSAN report
128128
ssize_t nread = mi_prim_read(fd, &buf, sizeof(buf));
129129
mi_prim_close(fd);
130130
// <https://www.kernel.org/doc/Documentation/vm/overcommit-accounting>
@@ -871,6 +871,7 @@ bool _mi_prim_random_buf(void* buf, size_t buf_len) {
871871
#elif defined(__ANDROID__) || defined(__DragonFly__) || \
872872
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
873873
defined(__sun) || \
874+
defined(__CYGWIN__) /* CPython: gh-148461 */ || \
874875
(defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7))
875876

876877
bool _mi_prim_random_buf(void* buf, size_t buf_len) {

‎Objects/mimalloc/random.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ uintptr_t _mi_os_random_weak(uintptr_t extra_seed) {
178178
}
179179

180180
static void mi_random_init_ex(mi_random_ctx_t* ctx, bool use_weak) {
181-
uint8_t key[32] = {0};
181+
uint8_t key[32] = {0}; // CPython: zero-initialize to avoid an MSAN report
182182
if (use_weak || !_mi_prim_random_buf(key, sizeof(key))) {
183183
// if we fail to get random data from the OS, we fall back to a
184184
// weak random source based on the current time

0 commit comments

Comments
 (0)