[pypy-dev] os.wait() implementation

Armin Rigo arigo at tunes.org
Sun Nov 22 12:29:24 CET 2009


Hi Dan,

On Sat, Nov 21, 2009 at 12:00:38PM -0800, Dan Roberts wrote:
>    I now have an application-level implementation of os.wait() complete.
> It's built on top of os.waitpid(), but according to the documentation
> I've found, the behavior should be the same.

Thank you !

> +    def wait():
> +        import os
> +        return os.waitpid(-1, 0)

It's more a general issue with app_posix.py, but I think that it should
avoid these costly "import os" inside application-level functions.  You
already have the posix module imported (see the start of app_posix.py),
so you can return posix.waitpid(-1, 0).  The same comment applies to
other places too, e.g. popenfile.close().


A bientot,

Armin.



More information about the Pypy-dev mailing list