Skip to content

Commit 49beab3

Browse files
Update subprocess.Popen args for Python 3.9+ (#1679)
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent d45b33c commit 49beab3

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ Release date: TBA
105105

106106
Closes PyCQA/pylint#6017
107107

108+
* Updated the stdlib brain for ``subprocess.Popen`` to accommodate Python 3.9+.
109+
110+
Closes PyCQA/pylint#7092
111+
108112

109113
What's New in astroid 2.11.6?
110114
=============================

astroid/brain/brain_subprocess.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,26 @@
66

77
from astroid.brain.helpers import register_module_extender
88
from astroid.builder import parse
9-
from astroid.const import PY39_PLUS
9+
from astroid.const import PY39_PLUS, PY310_PLUS, PY311_PLUS
1010
from astroid.manager import AstroidManager
1111

1212

1313
def _subprocess_transform():
1414
communicate = (bytes("string", "ascii"), bytes("string", "ascii"))
1515
communicate_signature = "def communicate(self, input=None, timeout=None)"
1616
args = """\
17-
self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None,
18-
preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None,
19-
universal_newlines=False, startupinfo=None, creationflags=0, restore_signals=True,
17+
self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None,
18+
preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None,
19+
universal_newlines=None, startupinfo=None, creationflags=0, restore_signals=True,
2020
start_new_session=False, pass_fds=(), *, encoding=None, errors=None, text=None"""
21+
22+
if PY39_PLUS:
23+
args += ", user=None, group=None, extra_groups=None, umask=-1"
24+
if PY310_PLUS:
25+
args += ", pipesize=-1"
26+
if PY311_PLUS:
27+
args += ", process_group=None"
28+
2129
init = f"""
2230
def __init__({args}):
2331
pass"""

0 commit comments

Comments
 (0)