Skip to content

Commit 343a4ae

Browse files
committed
internal/subprocess(refactor[typing]): Align preexec_fn with typeshed
why: Use Callable[[], object] to match Python's official typeshed, accepting functions that return values (which subprocess ignores). what: - Change preexec_fn return type from None to object - Update both subprocess.py and run.py
1 parent 37fdb22 commit 343a4ae

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/libvcs/_internal/run.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def run(
147147
stdin: _FILE | None = None,
148148
stdout: _FILE | None = None,
149149
stderr: _FILE | None = None,
150-
preexec_fn: t.Callable[[], None] | None = None,
150+
preexec_fn: t.Callable[[], object] | None = None,
151151
close_fds: bool = True,
152152
shell: bool = False,
153153
cwd: StrOrBytesPath | None = None,

‎src/libvcs/_internal/subprocess.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin):
9797
stderr : _FILE
9898
Child's standard error, taking the same values as ``stdin``, plus
9999
:data:`subprocess.STDOUT` to fold it into ``stdout``.
100-
preexec_fn : t.Callable[[], None] | None
100+
preexec_fn : t.Callable[[], object] | None
101101
POSIX-only callable run in the child between fork and exec, or
102102
``None`` to run nothing.
103103
close_fds : bool
@@ -179,7 +179,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin):
179179
stdin: _FILE = None
180180
stdout: _FILE = None
181181
stderr: _FILE = None
182-
preexec_fn: t.Callable[[], None] | None = None
182+
preexec_fn: t.Callable[[], object] | None = None
183183
close_fds: bool = True
184184
shell: bool = False
185185
cwd: StrOrBytesPath | None = None

0 commit comments

Comments
 (0)