Title: In handle_process_output don't forward finalizer result by EliahKagan · Pull Request #1788 · gitpython-developers/GitPython · GitHub
Open Graph Title: In handle_process_output don't forward finalizer result by EliahKagan · Pull Request #1788 · gitpython-developers/GitPython
X Title: In handle_process_output don't forward finalizer result by EliahKagan · Pull Request #1788 · gitpython-developers/GitPython
Description: 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 annotations 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. This builds on #1755, which mentioned this issue but did not fix it. However, there is another way to fix it, which is what would have to be done instead of this if the function were public, and which I think is what should be done if, for any reason, it is intended that it continue to forward the result of a finalizer in the event that a finalizer ever returns one. The implementation could be put back to what it was before or something similar to it, and the annotations could be updated to allow the function to return a value. It occurs to me that this may have been what was intended all along, and that the annotations might not have reflected it due to the absence of @overload support in some type checker that was in use at the time, or perhaps unawareness of it. (GitPython is using @overload elsewhere at present.) I was not sure which approach should be taken to fix the inconsistency in handle_process_output, so I chose the simpler approach of not forwarding the result. However, if you would prefer to retain the old behavior (even aspects of it that are not in use in GitPython) and instead fix the annotations, I'd be pleased to do so. In that case, either this pull request could be closed and a new one created, or I could add another commit to it for the change.
Open Graph Description: 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. ...
X Description: 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. ...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1788
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:a64bc9d8-d7b0-8752-a0c7-203a498e8658 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | A90A:371CF1:F68B4:14C439:69684BE6 |
| html-safe-nonce | c3ac746334d03bcb2dac907db593883b635aba157f6b42ce16d22281ea8b0570 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTBBOjM3MUNGMTpGNjhCNDoxNEM0Mzk6Njk2ODRCRTYiLCJ2aXNpdG9yX2lkIjoiMzk0MTg5NzMzNjY4MzQyNzU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f741db39146b741b81bc139ae60c864942e29e35cce0d83154661e66e23bd764 |
| hovercard-subject-tag | pull_request:1656649064 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1788/checks |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | 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. ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f16c57f41ed243e5b4dfe9b9bcd6828bd83080b1b6dbb4ff239bbe9745f12e0c |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfa7062cc6d4fe8fcb156bd33f4c97bd3b2470af |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width