File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,10 @@ Customize Memory Allocators
476
476
thread-safe: the :term: `GIL <global interpreter lock> ` is not held when the
477
477
allocator is called.
478
478
479
+ For the remaining domains, the allocator must also be thread-safe:
480
+ the allocator may be called in different interpreters that do not
481
+ share a ``GIL ``.
482
+
479
483
If the new allocator is not a hook (does not call the previous allocator),
480
484
the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the
481
485
debug hooks on top on the new allocator.
@@ -500,6 +504,8 @@ Customize Memory Allocators
500
504
**must** wrap the existing allocator. Substituting the current
501
505
allocator for some other arbitrary one is **not supported**.
502
506
507
+ .. versionchanged:: 3.12
508
+ All allocators must be thread-safe.
503
509
504
510
505
511
.. c:function:: void PyMem_SetupDebugHooks(void)
Original file line number Diff line number Diff line change @@ -1880,6 +1880,13 @@ Porting to Python 3.12
1880
1880
* :c:func: `PyUnstable_Long_IsCompact `
1881
1881
* :c:func: `PyUnstable_Long_CompactValue `
1882
1882
1883
+ * Custom allocators, set via :c:func: `PyMem_SetAllocator `, are now
1884
+ required to be thread-safe, regardless of memory domain. Allocators
1885
+ that don't have their own state, including "hooks", are not affected.
1886
+ If your custom allocator is not already thread-safe and you need
1887
+ guidance then please create a new GitHub issue
1888
+ and CC ``@ericsnowcurrently ``.
1889
+
1883
1890
Deprecated
1884
1891
----------
1885
1892
You can’t perform that action at this time.
0 commit comments