MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/subprocess.py:816–1074  ·  view source on GitHub ↗

Create new Popen instance.

(self, args, bufsize=-1, executable=None,
                 stdin=None, stdout=None, stderr=None,
                 preexec_fn=None, close_fds=True,
                 shell=False, cwd=None, env=None, universal_newlines=None,
                 startupinfo=None, creationflags=0,
                 restore_signals=True, start_new_session=False,
                 pass_fds=(), *, user=None, group=None, extra_groups=None,
                 encoding=None, errors=None, text=None, umask=-1, pipesize=-1,
                 process_group=None)

Source from the content-addressed store, hash-verified

814 _child_created = False # Set here since __del__ checks it
815
816 def __init__(self, args, bufsize=-1, executable=None,
817 stdin=None, stdout=None, stderr=None,
818 preexec_fn=None, close_fds=True,
819 shell=False, cwd=None, env=None, universal_newlines=None,
820 startupinfo=None, creationflags=0,
821 restore_signals=True, start_new_session=False,
822 pass_fds=(), *, user=None, group=None, extra_groups=None,
823 encoding=None, errors=None, text=None, umask=-1, pipesize=-1,
824 process_group=None):
825 """Create new Popen instance."""
826 if not _can_fork_exec:
827 raise OSError(
828 errno.ENOTSUP, f"{sys.platform} does not support processes."
829 )
830
831 _cleanup()
832 # Held while anything is calling waitpid before returncode has been
833 # updated to prevent clobbering returncode if wait() or poll() are
834 # called from multiple threads at once. After acquiring the lock,
835 # code must re-check self.returncode to see if another thread just
836 # finished a waitpid() call.
837 self._waitpid_lock = threading.Lock()
838
839 self._input = None
840 self._communication_started = False
841 if bufsize is None:
842 bufsize = -1 # Restore default
843 if not isinstance(bufsize, int):
844 raise TypeError("bufsize must be an integer")
845
846 if stdout is STDOUT:
847 raise ValueError("STDOUT can only be used for stderr")
848
849 if pipesize is None:
850 pipesize = -1 # Restore default
851 if not isinstance(pipesize, int):
852 raise TypeError("pipesize must be an integer")
853
854 if _mswindows:
855 if preexec_fn is not None:
856 raise ValueError("preexec_fn is not supported on Windows "
857 "platforms")
858 else:
859 # POSIX
860 if pass_fds and not close_fds:
861 warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
862 close_fds = True
863 if startupinfo is not None:
864 raise ValueError("startupinfo is only supported on Windows "
865 "platforms")
866 if creationflags != 0:
867 raise ValueError("creationflags is only supported on Windows "
868 "platforms")
869
870 self.args = args
871 self.stdin = None
872 self.stdout = None
873 self.stderr = None

Callers

nothing calls this directly

Calls 15

_get_handlesMethod · 0.95
_execute_childMethod · 0.95
isinstanceFunction · 0.85
SubprocessErrorClass · 0.85
_text_encodingFunction · 0.85
hasattrFunction · 0.85
filterFunction · 0.85
LockMethod · 0.80
_cleanupFunction · 0.70
warnMethod · 0.45
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected