[Python-checkins] gh-103300: Fix `Popen.wait()` deadlock in patchcheck.py (#103301)

kumaraditya303 webhook-mailer at python.org
Sun Apr 9 04:19:00 EDT 2023


https://github.com/python/cpython/commit/86d20441557bedbea3dadd5d0818a492148335bd
commit: 86d20441557bedbea3dadd5d0818a492148335bd
branch: main
author: Oleg Iarygin <oleg at arhadthedev.net>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-04-09T13:48:53+05:30
summary:

gh-103300: Fix `Popen.wait()` deadlock in patchcheck.py (#103301)

files:
M Tools/patchcheck/patchcheck.py

diff --git a/Tools/patchcheck/patchcheck.py b/Tools/patchcheck/patchcheck.py
index 6dcf61206619..44a6fb8c660c 100755
--- a/Tools/patchcheck/patchcheck.py
+++ b/Tools/patchcheck/patchcheck.py
@@ -130,9 +130,10 @@ def changed_files(base_branch=None):
         with subprocess.Popen(cmd.split(),
                               stdout=subprocess.PIPE,
                               cwd=SRCDIR) as st:
-            if st.wait() != 0:
+            git_file_status, _ = st.communicate()
+            if st.returncode != 0:
                 sys.exit(f'error running {cmd}')
-            for line in st.stdout:
+            for line in git_file_status.splitlines():
                 line = line.decode().rstrip()
                 status_text, filename = line.split(maxsplit=1)
                 status = set(status_text)



More information about the Python-checkins mailing list