Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7057b9b

Browse filesBrowse files
committed
In handle_process_output don't forward finalizer result
The git.cmd.handle_process_output function is non-public (git.cmd.__all__ only lists Git) but used throughout GitPython and referenced in the git.util.RemoteProgress.new_message_handler docstring. Its finalizer argument is annotated to accept an optional callable that always returns None. It is always used this way in GitPython and RemoteProcess.new_message_handler is annotated accordingly. However, the handle_process_output docstring and implementation had documented the return value as the result of the finalizer, and the implementation had forwarded that result if passed. This modifies the docstring and implementation to disregard any result, in accordance with the everywhere-annotated assumption that the finalizer is conceptually void and the absence of any code in GitPython that uses the result of calling handle_process_output. None is now implicitly returned, simplifying the implementation and bringing it and the docstring in line with annotationd and usage. This would be a breaking change if done on a public function, but because handle_process_output is nonpublic (and documentation for it is omitted by Sphinx, so users probably don't wrongly think it is public), I believe this is safe and non-breaking.
1 parent 86d0177 commit 7057b9b
Copy full SHA for 7057b9b

File tree

1 file changed

+1
-4
lines changed
Filter options

1 file changed

+1
-4
lines changed

‎git/cmd.py

Copy file name to clipboardExpand all lines: git/cmd.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def handle_process_output(
111111
112112
This function returns once the finalizer returns.
113113
114-
:return: Result of finalizer
115114
:param process: :class:`subprocess.Popen` instance
116115
:param stdout_handler: f(stdout_line_string), or None
117116
:param stderr_handler: f(stderr_line_string), or None
@@ -205,9 +204,7 @@ def pump_stream(
205204
stderr_handler(error_str) # type: ignore
206205

207206
if finalizer:
208-
return finalizer(process)
209-
else:
210-
return None
207+
finalizer(process)
211208

212209

213210
def dashify(string: str) -> str:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.