Title: OSError is not documented in ssl library, but still can be thrown
Type: behavior Stage:
Components: Documentation, SSL Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: christian.heimes, docs@python, martin.panter, paxdiablo, sibiryakov
Priority: normal Keywords:

Created on 2020-07-31 14:36 by sibiryakov, last changed 2020-08-03 09:53 by paxdiablo.

Messages (3)
msg374644 - (view) Author: Alexander Sibiryakov (sibiryakov) Date: 2020-07-31 14:36
See stack trace
[07/15/2020 08:51:14.799: ERROR/kafka.producer.sender] Uncaught error in kafka producer I/O thread
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/kafka/producer/", line 60, in run
File "/usr/local/lib/python3.6/site-packages/kafka/producer/", line 160, in run_once
File "/usr/local/lib/python3.6/site-packages/kafka/", line 580, in poll
File "/usr/local/lib/python3.6/site-packages/kafka/", line 390, in _maybe_connect
File "/usr/local/lib/python3.6/site-packages/kafka/", line 426, in connect
if self._try_handshake():
File "/usr/local/lib/python3.6/site-packages/kafka/", line 505, in _try_handshake
File "/usr/local/lib/python3.6/", line 1077, in do_handshake
File "/usr/local/lib/python3.6/", line 689, in do_handshake
OSError: [Errno 0] Error

See docs

and see source code:

Probably the best would be to proceed with using SSLError, but short term OSError could be documented.
msg374651 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2020-08-01 03:29
Issue 31122 is also open about fixing this long-term, but I agree it would be good to document this quirk / bug.
msg374731 - (view) Author: Allan Chandler (paxdiablo) Date: 2020-08-03 09:53
If you look through the source for PyExc, you'll find items for (over and above OsError) ValueError, NotImplementedError, TypeError, OverflowError, AttributeError, MemoryError, UnicodeEncodeError, and RuntimeWarning. I don't think ANY of those are documented so are we going to fix them all? Or should we just list them as possibilities in the doco (or, even more vaguely, state that exceptions other than the documented SSL ones are also possible)?
Date User Action Args
2020-08-03 09:53:19paxdiablosetnosy: + paxdiablo
messages: + msg374731
2020-08-01 03:29:57martin.pantersetnosy: + martin.panter
messages: + msg374651
2020-07-31 15:10:49xtreaksetnosy: + christian.heimes
2020-07-31 15:10:28xtreaksetcomponents: + SSL
2020-07-31 14:36:27sibiryakovcreate