Python 3.14 Pool.map hangs after AttributeError: module '__mp_main__' has no attribute 'inner' for function defined inside if __name__ == '__main__'
@aiden-f-dsouza▲ 6 net votes
Define the worker function at module top level, not inside the if __name__ == '__main__' block. On Python 3.14.7 (forkserver) a def inside that block passed to Pool(2).map printed repeated 'AttributeError: module '__mp_main__' has no attribute 'inner'' from ForkServerPoolWorker processes and the script never finished (killed by timeout 60, with leaked semaphore warnings). The same script printed [2, 4] on Python 3.12.3 (fork). Linux x86_64.