-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
asyncio.EventLoop.start_tls() returns None #105993
Comments
It seems reasonable to return None in this case, maybe the docs need to be updated? |
OK, mainly wanted to confirm this wasn't deemed a bug before updating typeshed, but a doc update would be good too. |
I would note that aiohttp seems to already expect a bunch of exceptions from this function, so I think it'd be simpler for us if there was an exception here. But, I'm not really familiar with the code, so I don't have a strong opinion. If you want to stick with the current behaviour, I've made a PR for the documentation: #105995 |
I really don't know -- I have never used the TLS functionality in asyncio myself. Mayve @kumaraditya303 has an opinion? |
Have you investigated why aiohttp ends up passing a closing transport? |
I've not figured that out, but one cause might be something to do with the TLS-in-TLS proxy code. But, I guess client disconnection can happen at any time, so maybe it's just something that we'd expect to happen on the rare occasion, even when everything is working correctly. |
…p.start_tls` docs (pythonGH-105995) (cherry picked from commit 6b52a58) Co-authored-by: Sam Bull <git@sambull.org>
…p.start_tls` docs (pythonGH-105995) (cherry picked from commit 6b52a58) Co-authored-by: Sam Bull <git@sambull.org>
…p.start_tls` docs (pythonGH-105995) (cherry picked from commit 6b52a58) Co-authored-by: Sam Bull <git@sambull.org>
Okay, the PR is merged now. |
Bug report
The documentation says the function should return a transport:
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.start_tls
But, in some cases it actually returns None. It looks like this may happen when it receives a closing transport:
aio-libs/aiohttp#3355 (comment)
I suspect this is because connection_lost() gets called during the start_tls() call, which ends up setting it to None:
cpython/Lib/asyncio/sslproto.py
Line 412 in dba7217
Should this be allowed to return None, or should there be an exception occurring here?
A simple change could be to check for None and raise an exception, but I'm not too familiar with how this part of the code is expected to work.
Linked PRs
None
return type toasyncio.EventLoop.start_tls
docs (GH-105995) #106188None
return type toasyncio.EventLoop.start_tls
docs (GH-105995) #106189None
return type toasyncio.EventLoop.start_tls
docs (GH-105995) #106190The text was updated successfully, but these errors were encountered: