I've searched through the documentation and searched around but there is nothing said about blocking StringIO objects.
I could create my own file-like object that just simply wraps around StringIO but how is the best way to make it blocking? The only way I know is to use a while loop and a time.sleep(0.1) till there is data available.
import os
r, w = os.pipe()
r, w = os.fdopen(r, 'rb'), os.fdopen(w, 'wb')
Works exactly as I needed, this pipe function is sadly not very obvious in the documentation so I only found it later on.