Thinking more about this I think I will get rid of the Lock in _string_drainer() altogether and make it specific to string_stdin, because there will only be one thread modifying string_stdin.   There are no other methods that access self.sp.stdin or self.string_stdin, unlike get_stdout and get_stderr.