_init_posix() not ever called?

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? Thank you.

Hi, On Mon, 20 Sept 2021 at 22:33, M A <teammember0x01@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

On Sep 21, 2021, at 4:28 AM, Armin Rigo <armin.rigo@gmail.com> wrote:
Hi,
On Mon, 20 Sept 2021 at 22:33, M A <teammember0x01@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
Thank you Armin. So how do I make this function run again? For most projects I would be something like "make clean" to remove all the object files and start from the beginning. Does PyPy have anything like this?
participants (2)
-
Armin Rigo
-
M A