SSLObject made available through exceptions#11553
SSLObject made available through exceptions#11553fed239 wants to merge 6 commits intoaio-libs:masterfrom
Conversation
for more information, see https://pre-commit.ci
|
There is a bit of risk here that the ssl object now gets destroyed later if anything if holding a reference to a traceback with one of these exceptions or the exception itself. All potential paths need to be manually checked for leaks. |
CodSpeed Performance ReportMerging #11553 will not alter performanceComparing Summary
Footnotes |
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
webknjaz
left a comment
There was a problem hiding this comment.
Why not expose public interfaces for high-level things one might want to access. Isn't saving an SSLContext a leaky abstraction?
|
|
||
| try: | ||
| return transport.get_extra_info("ssl_object") | ||
| except Exception: |
There was a problem hiding this comment.
I don't think that suppressing arbitrary exceptions is a good idea. There's a very small number of cases where this is acceptable in general.
| connection: Optional[Union["Connection", object]], | ||
| ) -> Optional[object]: |
There was a problem hiding this comment.
Optionals are considered confusing, use unions instead. Also, None is an object. So None | object is just object. Plus accepting arbitrary objects in args isn't a great idea.
| status: Optional[int] = None, | ||
| message: str = "", | ||
| headers: Optional[MultiMapping[str]] = None, | ||
| ssl_object: Optional[object] = None, |
There was a problem hiding this comment.
This shouldn't be an arbitrary object.
Delaying on this. The other comments can be easily resolved (I don't mind fixing the typing, for example). |
What do these changes do?
These changes implement SSL certificate access functionality for ClientResponseError exceptions and all its subclasses.
Are there changes in behavior for the user?
No breaking changes, the implementation is backward compatible: users can now optionally access exception.ssl_object to get SSL certificate information.
Is it a substantial burden for the maintainers to support this?
Should minimal maintenance burden.
Related issue number
Fixes #10028
Checklist
CONTRIBUTORS.txtCHANGES/foldername it
<issue_or_pr_num>.<type>.rst(e.g.588.bugfix.rst)if you don't have an issue number, change it to the pull request
number after creating the PR
.bugfix: A bug fix for something the maintainers deemed animproper undesired behavior that got corrected to match
pre-agreed expectations.
.feature: A new behavior, public APIs. That sort of stuff..deprecation: A declaration of future API removals and breakingchanges in behavior.
.breaking: When something public is removed in a breaking way.Could be deprecated in an earlier release.
.doc: Notable updates to the documentation structure or buildprocess.
.packaging: Notes for downstreams about unobvious side effectsand tooling. Changes in the test invocation considerations and
runtime assumptions.
.contrib: Stuff that affects the contributor experience. e.g.Running tests, building the docs, setting up the development
environment.
.misc: Changes that are hard to assign to any of the abovecategories.
Make sure to use full sentences with correct case and punctuation,
for example:
Use the past tense or the present tense a non-imperative mood,
referring to what's changed compared to the last released version
of this project.