Sergey Nudnou <nsm...@belintech.com> added the comment:

Hello,

I've just run into a related issue. I have a python script, which starts an 
another python script using subprocess.Popen(). The parent script gets pid of 
the child and monitors up its activity through a database by this pid. The 
child script updates its activity in the database using the pid it gotten from 
os.getpid()

Both scripts live in a virtual environment.

It worked fine in Python 3.5 and stopped working after migration to Python 3.8.

My base Python location: D:\Python\Python38\pythonw.exe
Virtual Environment: D:\test\venv\Scripts\pythonw.exe

I have realized, that when I run the following from a command prompt:
D:\test\venv\Scripts\pythonw.exe test.py

2 processes with the different PIDs are created:
PID:                   97040
Parent PID:            12004  (cmd.exe)
Command Line:          D:\test\venv\Scripts\pythonw.exe test.py

PID:                   85548
Parent PID:            97040  (pythonw.exe)
Command Line:          D:\Python\Python38\pythonw.exe test.py

It is definitely a regression, and will potentially break a lot of applications 
expecting a child Python process to be a direct descendant of its parent.

Also it is a waste of system resources

----------
nosy: +nsmcan

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38905>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to