[pypy-dev] _init_posix() not ever called?

Armin Rigo armin.rigo at gmail.com
Tue Sep 21 04:28:24 EDT 2021


Hi,

On Mon, 20 Sept 2021 at 22:33, M A <teammember0x01 at gmail.com> wrote:
> Hi I was working in the file lib-python/2.7/distutils/sysconfig_pypy.py, on the function _init_posix(). I placed print() statements in the function to indicate when this function is called. After fully building pypy the print() statements were never called. I then used grep to try to find out where this function is called in the source code. I ran this command: grep "_init_posix()" -r *. After looking at the results it looks like this function is never called by anything. Why do we have it? More importantly can we delete it?

It is called from the same file by these line:

        func = globals().get("_init_" + os.name)
        if func:
            func()

If you don't see print statements at runtime, then it might be the
case that it's called at translation time instead.  The module's state
with _init_posix() already called would then get frozen inside the
translated pypy.


A bientôt,
Armin


More information about the pypy-dev mailing list