def mkstemp(suffix='', prefix='tmp', dir=None, text=False): if text: raise NotImplementedError if dir is None: dir = '' # TODO: Make suffix actually follow the rest of the filename. f, err = TempFile(dir, prefix + '-' + suffix) if err: raise OSError(err.Error()) try: fd, err = Dup(f.Fd()) if err: raise OSError(err.Error()) return fd, f.Name() finally: f.Close()