From a54e5a84284b605ee1c41bac2d2680da96edc5cd Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 19 Aug 2025 12:56:34 -0400 Subject: [PATCH] Move shm imports in `disable_mantracker()` to top-of-mod --- tractor/ipc/_mp_bs.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tractor/ipc/_mp_bs.py b/tractor/ipc/_mp_bs.py index 462291c6..63d99c7e 100644 --- a/tractor/ipc/_mp_bs.py +++ b/tractor/ipc/_mp_bs.py @@ -17,6 +17,8 @@ Utils to tame mp non-SC madeness ''' +from functools import partial +from multiprocessing.shared_memory import SharedMemory import platform @@ -26,7 +28,6 @@ def disable_mantracker(): it's an absolute multi-threaded mess of non-SC madness. ''' - from multiprocessing.shared_memory import SharedMemory # 3.13+ only.. can pass `track=False` to disable @@ -38,7 +39,6 @@ def disable_mantracker(): ('3', '13') ) ): - from functools import partial return partial( SharedMemory, track=False, @@ -70,6 +70,4 @@ def disable_mantracker(): mantracker.getfd = mantracker._resource_tracker.getfd # use std type verbatim - shmT = SharedMemory - - return shmT + return SharedMemory