[PR #6923/78fa0401 backport][3.8] Exclude the object
possibility from the ClientSession.timeout
type
#6925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #6923 as merged into master (78fa040).
What do these changes do?
This is a follow-up PR to #6917, which fixes the overly inclusive typing of
ClientSession.timeout
attribute, which can never actually end up as anobject
instance. This leftover probably exists from the time when there was the_sentinel
value being assigned to the attribute (see "3.8 branchself._timeout
assignment" from the linked issue), hence why it ended up this way.Are there changes in behavior for the user?
For untyped code, there's absolutely no change - the
self._timeout
attribute was never actually assigned the sentinel value to. Most of the explanation already exists in #6917, here's the test code snippet from there again:For typed code, the current solution would be to
assert isinstance(session.timeout, aiohttp.ClientTimeout)
everywhere the attribute is being accessed. This PR removes this "unnecessary necessity".Related issue number
#6917
Checklist
object
instance being accessible from there even)CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.