Quick answer: Send (surface.tobytes(), size, format) tuples. Reconstruct via pygame.image.fromstring. Or load in worker by path.

Parallel asset preprocessor. Worker tries to return Surface; pickle errors. Pygame Surface holds non-picklable C state.

The Fix

# Worker
def load_surface_bytes(path):
    surf = pygame.image.load(path)
    return (surf.tobytes(), surf.get_size(), "RGBA")

# Main
data, size, fmt = pool.apply(load_surface_bytes, ("sprite.png",))
surf = pygame.image.fromstring(data, size, fmt)

Bytes transit the IPC boundary. Reconstruction in the main process produces a fresh Surface backed by display. Cheaper than re-loading from disk if the worker did expensive processing.

Verifying

Pool.apply returns tuple; reconstructed surface blits identically. Without conversion: pickle error in apply.

“Bytes across boundary. Reconstruct on receive.”

Related Issues

For PyInstaller assets, see PyInstaller. For convert_alpha, see convert.

Bytes pickle. Surface no.