-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
SSLObject made available through exceptions #11553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.txt
CHANGES/
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.