| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Oh, I see. Looks like the idea behind Any here is that different subtypes can use different sock types. What's is the policy in this case? Do we fallback to Any or do we require # type: ignore[override] for such cases? |
Sorry, something went wrong.
|
This looks quite disruptive, and in practice, users can probably be confident that sock will be a socket object after .connect() has been called. Maybe try sock: socket | Any instead, with a comment explaining that it could be None if connect() has not yet been called? |
Sorry, something went wrong.
|
Please add something like sock: SSLSocket | Any into HTTPSConnection. HTTPS connections never use unencrypted socket.sockets. |
Sorry, something went wrong.
|
Sure! Source: https://github.com/python/cpython/blob/310f94871a923f6cf3dc9259e732ce2376578b26/Lib/http/client.py#L1456-L1457 |
Sorry, something went wrong.
|
Diff from mypy_primer, showing the effect of this PR on open source code: urllib3 (https://github.com/urllib3/urllib3)
+ test/with_dummyserver/test_https.py:463: error: Item "socket" of "Union[socket, Any]" has no attribute "server_hostname" [union-attr]
+ test/with_dummyserver/test_https.py:784: error: Item "socket" of "Union[socket, Any]" has no attribute "version" [union-attr]
+ test/with_dummyserver/test_https.py:882: error: Item "socket" of "Union[socket, Any]" has no attribute "version" [union-attr]
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
It can be either: