diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 09477b22d95413f..925f425aba58693 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -1295,11 +1295,6 @@ Build changes (Contributed by Stan Ulbrych, Florian Mayer and AnnaAr321 in :gh:`156049`.) -* Update the bundled `mimalloc library`_ from version 2.1.2 to 2.5.2. - (Contributed by Donghee Na in :gh:`159111`.) - - .. _mimalloc library: https://github.com/microsoft/mimalloc/ - C API changes ============= diff --git a/Include/internal/mimalloc/mimalloc/internal.h b/Include/internal/mimalloc/mimalloc/internal.h index eb4b8c2d5dc1f02..83bf6348a5561c3 100644 --- a/Include/internal/mimalloc/mimalloc/internal.h +++ b/Include/internal/mimalloc/mimalloc/internal.h @@ -102,6 +102,8 @@ terms of the MIT license. A copy of the license can be found in the file #define mi_decl_externc #endif +// CPython: upstream defines __wasi__ on Emscripten here. It is removed so that +// CPython code can distinguish the two platforms (gh-158628). // -------------------------------------------------------------------------- // Internal functions diff --git a/Objects/mimalloc/os.c b/Objects/mimalloc/os.c index 9c9683ce594f345..ab1813a74724417 100644 --- a/Objects/mimalloc/os.c +++ b/Objects/mimalloc/os.c @@ -276,6 +276,7 @@ static void* mi_os_prim_alloc_aligned(size_t size, size_t alignment, bool commit else { // if not aligned, free it, overallocate, and unmap around it #if !MI_TRACK_ASAN + // CPython: downgraded from _mi_warning_message, the warning is noisy in the test suite (gh-112027) _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); #endif if (p != NULL) { mi_os_prim_free(p, size, (commit ? size : 0)); } diff --git a/Objects/mimalloc/prim/unix/prim.c b/Objects/mimalloc/prim/unix/prim.c index 87b3c96ea6045c8..c66198464e72a21 100644 --- a/Objects/mimalloc/prim/unix/prim.c +++ b/Objects/mimalloc/prim/unix/prim.c @@ -124,7 +124,7 @@ static bool unix_detect_overcommit(void) { #if defined(__linux__) int fd = mi_prim_open("/proc/sys/vm/overcommit_memory", O_RDONLY); if (fd >= 0) { - char buf[32] = {0}; + char buf[32] = {0}; // CPython: zero-initialize to avoid an MSAN report ssize_t nread = mi_prim_read(fd, &buf, sizeof(buf)); mi_prim_close(fd); // @@ -871,6 +871,7 @@ bool _mi_prim_random_buf(void* buf, size_t buf_len) { #elif defined(__ANDROID__) || defined(__DragonFly__) || \ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ defined(__sun) || \ + defined(__CYGWIN__) /* CPython: gh-148461 */ || \ (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)) bool _mi_prim_random_buf(void* buf, size_t buf_len) { diff --git a/Objects/mimalloc/random.c b/Objects/mimalloc/random.c index b216c4c3505568c..f19520d930cb995 100644 --- a/Objects/mimalloc/random.c +++ b/Objects/mimalloc/random.c @@ -178,7 +178,7 @@ uintptr_t _mi_os_random_weak(uintptr_t extra_seed) { } static void mi_random_init_ex(mi_random_ctx_t* ctx, bool use_weak) { - uint8_t key[32] = {0}; + uint8_t key[32] = {0}; // CPython: zero-initialize to avoid an MSAN report if (use_weak || !_mi_prim_random_buf(key, sizeof(key))) { // if we fail to get random data from the OS, we fall back to a // weak random source based on the current time