cpython/Modules
Miss Islington (bot) b5bf6c1b22
[3.10] GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495) (#103007)
GH-25309 enabled SSL_OP_IGNORE_UNEXPECTED_EOF by default, with a comment
that it restores OpenSSL 1.1.1 behavior, but this wasn't quite right.
That option causes OpenSSL to treat transport EOF as the same as
close_notify (i.e. SSL_ERROR_ZERO_RETURN), whereas Python actually has
distinct SSLEOFError and SSLZeroReturnError exceptions. (The latter is
usually mapped to a zero return from read.) In OpenSSL 1.1.1, the ssl
module would raise them for transport EOF and close_notify,
respectively. In OpenSSL 3.0, both act like close_notify.

Fix this by, instead, just detecting SSL_R_UNEXPECTED_EOF_WHILE_READING
and mapping that to the other exception type.

There doesn't seem to have been any unit test of this error, so fill in
the missing one. This had to be done with the BIO path because it's
actually slightly tricky to simulate a transport EOF with Python's fd
based APIs. (If you instruct the server to close the socket, it gets
confused, probably because the server's SSL object is still referencing
the now dead fd?)
(cherry picked from commit 420bbb783b)

Co-authored-by: David Benjamin <davidben@google.com>
2023-03-27 16:14:24 +02:00
..
_blake2 [3.10] gh-102027: Fix macro name (GH-102124) (#102917) 2023-03-24 13:40:32 +01:00
_ctypes [3.10] [3.11] gh-99952: fix refcount issues in ctypes.Structure from_param() result (GH-101339) (#101340) 2023-02-04 12:09:29 -08:00
_decimal bpo-45332: Fix broken Decimal test and benchmark (GH-28680) 2021-10-01 07:16:37 -07:00
_io gh-82052: Don't send partial UTF-8 sequences to the Windows API (GH-101103) 2023-01-17 11:53:45 -08:00
_multiprocessing GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738) 2022-07-11 05:39:09 -07:00
_sha3 [3.10] GH-98671: bpo-46670: Fix #ifdef in sha3module.c (GH-90828) (#98677) 2022-10-28 12:13:44 +02:00
_sqlite [3.10] gh-94321: Document sqlite3.PrepareProtocol (GH-94620) (#94671) 2022-07-08 01:44:09 +02:00
_ssl bpo-43908: Mark ssl, hash, and hmac types as immutable (GH-25792) 2021-05-02 09:47:45 +02:00
_xxtestfuzz Fix typo in fuzzer.c (GH-25013) 2021-03-25 00:47:21 +09:00
cjkcodecs bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
clinic [3.10] Add missing 'is' to cmath.log() docstring (GH-102049) (#102280) 2023-02-26 14:56:10 +00:00
expat gh-98739: Update libexpat from 2.4.9 to 2.5.0 (GH-98742) 2022-10-27 14:22:18 -07:00
_abc.c bpo-43977: Properly update the tp_flags of existing subclasses when their parents are registered (GH-26864) 2021-06-25 08:46:23 -07:00
_asynciomodule.c [3.10] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#100059) 2022-12-06 18:40:30 +01:00
_bisectmodule.c gh-92839: fixed typo in _bisectmodule.c (line 131) (GH-92849) (#93321) 2022-05-28 13:48:25 -05:00
_bz2module.c bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
_codecsmodule.c [3.10] bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28952) 2021-10-14 21:23:39 +03:00
_collectionsmodule.c GH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979) 2023-03-23 18:10:34 -07:00
_contextvarsmodule.c
_cryptmodule.c closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) (GH-28636) 2021-09-30 01:02:11 +02:00
_csv.c gh-65496: Correct wording on csv's skipinitialspace argument (GH-96170) 2022-10-07 12:30:39 -07:00
_curses_panel.c bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag (GH-25721) 2021-04-30 12:46:15 +02:00
_cursesmodule.c GH-94644: fix test_curses ref leak (GH-94647) 2022-07-07 04:41:06 -07:00
_datetimemodule.c gh-91838: Resolve HTTP links which redirect to HTTPS (GH-95642) 2022-08-04 06:15:01 -07:00
_dbmmodule.c bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
_elementtree.c bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152) 2022-02-12 00:50:11 -08:00
_functoolsmodule.c gh-96641: Do not expose KeyWrapper in _functoolsmodule.c (gh-96642) 2022-09-07 04:50:15 -07:00
_gdbmmodule.c [3.10] bpo-45060: Get rid of few uses of the equality operators with None (GH-28087). (GH-28092) 2021-09-03 21:13:00 -04:00
_hashopenssl.c DOC: correct bytesarray -> bytearray in comments (GH-92410) (GH-94090) 2022-06-22 10:48:14 +02:00
_heapqmodule.c
_json.c [3.10] Remove trailing spaces (GH-28709) 2021-10-03 20:03:49 +03:00
_localemodule.c
_lsprof.c GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315) 2022-07-27 05:28:26 -07:00
_lzmamodule.c bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
_math.c [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-22 01:33:59 +02:00
_math.h
_opcode.c
_operator.c DOC: correct bytesarray -> bytearray in comments (GH-92410) (GH-94090) 2022-06-22 10:48:14 +02:00
_pickle.c gh-83004: Clean up refleak in _pickle initialisation (GH-98841) 2022-11-06 06:44:28 -08:00
_posixsubprocess.c [3.10] gh-91401: Conservative backport of subprocess._USE_VFORK (#91932) 2022-05-01 16:09:50 -07:00
_queuemodule.c bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
_randommodule.c Eliminate duplicated assignment in _randommodule.c (GH-25904) (GH-25909) 2021-05-04 21:39:09 -07:00
_scproxy.c
_sre.c [3.10] gh-98740: Fix validation of conditional expressions in RE (GH-98764) (GH-99046) 2022-11-03 12:18:50 +02:00
_ssl.c [3.10] GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495) (#103007) 2023-03-27 16:14:24 +02:00
_ssl.h bpo-18233: Add internal methods to access peer chain (GH-25467) 2021-04-26 15:01:40 +02:00
_ssl_data.h
_ssl_data_111.h bpo-43788: Generate version specific _ssl_data.h (GH-25300) 2021-04-09 08:02:00 -07:00
_ssl_data_300.h bpo-43788: Generate version specific _ssl_data.h (GH-25300) 2021-04-09 08:02:00 -07:00
_stat.c
_statisticsmodule.c
_struct.c GH-94254: Make _struct module types immutable (GH-94269) 2022-06-26 03:45:00 -07:00
_testbuffer.c bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587) 2020-12-01 10:37:39 +01:00
_testcapimodule.c [3.10] GH-100892: Fix race in clearing threading.local (GH-100922). (#100938) 2023-01-11 21:02:02 +05:30
_testclinic.c [3.10] gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241) (#100353) 2022-12-20 15:50:42 +05:30
_testimportmultiple.c
_testinternalcapi.c Fix NULL test in _testinternalcapi (GH-92861) 2022-05-16 18:54:47 -07:00
_testmultiphase.c [3.10] bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696) (GH-31262) 2022-02-11 12:25:25 +01:00
_threadmodule.c [3.10] GH-100892: Fix race in clearing threading.local (GH-100922). (#100938) 2023-01-11 21:02:02 +05:30
_tkinter.c [3.10] Fix typos in the Modules directory (GH-28761) (GH-28781) 2021-10-07 01:55:18 -07:00
_tracemalloc.c bpo-46280: Fix tracemalloc_copy_domain() (GH-30591) 2022-01-13 20:32:40 -08:00
_uuidmodule.c
_weakref.c
_winapi.c bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684) 2022-12-02 10:13:33 +00:00
_xxsubinterpretersmodule.c bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag (GH-25721) 2021-04-30 12:46:15 +02:00
_zoneinfo.c gh-83004: Clean up refleak in _zoneinfo initialisation (GH-98842) 2022-11-06 06:38:26 -08:00
addrinfo.h
arraymodule.c [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-22 01:33:59 +02:00
atexitmodule.c fixes gh-96292: Fix Trivial Typo in cpython/Modules/atexitmodule.c (GH-96327) 2022-08-26 22:53:47 -07:00
audioop.c [3.10] bpo-2716: add license for audioop module (GH-19972) (#98532) 2022-10-28 12:11:26 +02:00
binascii.c [3.10] bpo-38256: Fix binascii.crc32 large input. (GH-32000) (GH-32013) 2022-03-20 14:46:52 -07:00
cmathmodule.c [3.10] Add missing 'is' to cmath.log() docstring (GH-102049) (#102280) 2023-02-26 14:56:10 +00:00
config.c.in
errnomodule.c
faulthandler.c gh-96055: Update faulthandler to emit proper unexpect signal number (gh-99162) 2022-11-06 22:05:20 -08:00
fcntlmodule.c
gc_weakref.txt [3.10] Fix typos in the Modules directory (GH-28761) (GH-28781) 2021-10-07 01:55:18 -07:00
gcmodule.c gh-92036: Fix gc_fini_untrack() (GH-92037) 2022-05-04 03:23:29 -07:00
getaddrinfo.c
getbuildinfo.c bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100) 2021-10-20 10:41:35 -07:00
getnameinfo.c gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025) 2022-06-20 16:09:55 +02:00
getpath.c [3.10] Fix typos in the Modules directory (GH-28761) (GH-28781) 2021-10-07 01:55:18 -07:00
grpmodule.c
hashlib.h hashlib: Fix old message about unicode objects. (GH-28653) 2021-10-01 05:58:37 -07:00
itertoolsmodule.c [3.10] gh-60203: Revert changes in cycle.__setstate__ (GH-99982) (#100017) 2022-12-05 17:58:30 +01:00
ld_so_aix.in
main.c Typo in comment (GH-24199) 2021-01-25 14:51:48 -08:00
makesetup bpo-45571: use PY_CFLAGS_NODIST for shared Modules/Setup (GH-29161) 2021-10-22 11:22:01 -07:00
makexp_aix
mathmodule.c GH-98897: fix memory leak if math.dist raises exception (GH-98898) 2022-10-31 19:47:29 -07:00
md5module.c [3.10] bpo-42972: Fully support GC for hashlib heap types (GH-26374) (GH-26398) 2021-05-27 01:10:39 -07:00
mmapmodule.c bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) (GH-26766) 2021-06-17 11:19:44 +01:00
nismodule.c
ossaudiodev.c [3.10] bpo-46053: Fix OSS audio support on NetBSD (GH-30065). (GH-95477) 2022-07-31 11:19:09 +03:00
overlapped.c [3.10] gh-98793: Fix typecheck in overlapped.c (GH-98835) (#98890) 2022-10-31 11:22:02 -07:00
posixmodule.c [3.10] gh-102179: Fix os.dup2 error reporting for negative fds (GH-102180) (#102419) 2023-03-04 20:57:32 +05:30
posixmodule.h [3.10] bpo-41498: Fix build on platforms without sigset_t (GH-29770) (GH-29773) 2021-11-25 03:53:07 -08:00
pwdmodule.c
pyexpat.c [3.10] gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)" (GH-100745) (#100847) 2023-01-08 19:05:40 +05:30
readline.c Fix readline.c compiler warning. (GH-98738) 2022-10-26 16:28:40 -07:00
README
resource.c bpo-42960: Add resource.RLIMIT_KQUEUES constant from FreeBSD (GH-24251) 2021-02-18 16:26:20 +01:00
rotatingtree.c
rotatingtree.h
selectmodule.c [3.10] bpo-41857: mention timeout argument units in select.poll() and select.depoll() doc-strings (GH-22406) 2022-01-21 11:02:25 +02:00
Setup bpo-40137: Add pycore_moduleobject.h internal header (GH-25507) 2021-04-22 00:52:52 +02:00
sha1module.c [3.10] Fix typos in the Modules directory (GH-28761) (GH-28781) 2021-10-07 01:55:18 -07:00
sha256module.c [3.10] bpo-42972: Fully support GC for hashlib heap types (GH-26374) (GH-26398) 2021-05-27 01:10:39 -07:00
sha512module.c [3.10] bpo-42972: Fully support GC for hashlib heap types (GH-26374) (GH-26398) 2021-05-27 01:10:39 -07:00
signalmodule.c [3.10] GH-102397: Fix segfault from race condition in signal handling (GH-102399) (#102527) 2023-03-08 13:51:13 +05:30
socketmodule.c gh-100795: Don't call freeaddrinfo on failure. (GH-101252) 2023-01-23 15:27:41 -08:00
socketmodule.h bpo-41798: Allocate _socket module C API on the heap (GH-24126) 2021-01-06 20:43:06 +01:00
spwdmodule.c
sre.h bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012) 2022-03-21 04:30:58 -07:00
sre_constants.h
sre_lib.h bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587) 2020-12-01 10:37:39 +01:00
symtablemodule.c bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583) 2021-05-03 10:43:00 +03:00
syslogmodule.c gh-98178: syslog() is not thread-safe on macOS (GH-98213) 2022-10-13 05:05:18 -07:00
termios.c [3.10] GH-97001: Release GIL in termios extension (GH-99503) (#99680) 2022-11-22 12:33:32 +01:00
testcapi_long.h
timemodule.c
tkappinit.c
tkinter.h
unicodedata.c gh-101372: Fix unicodedata.is_normalized to properly handle the UCD 3… (gh-101388) 2023-02-06 02:32:58 -08:00
unicodedata_db.h
unicodename_db.h
winreparse.h
xxlimited.c bpo-42972: Fully implement GC protocol for xxlimited (GH-26451) (GH-26460) 2021-05-31 12:23:13 +01:00
xxlimited_35.c gh-90763: Modernise xx template module initialisation (GH-93078) 2022-06-10 04:16:57 -07:00
xxmodule.c gh-90763: Modernise xx template module initialisation (GH-93078) 2022-06-10 04:16:57 -07:00
xxsubtype.c
zlibmodule.c [3.10] bpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29587) (GH-29811) 2021-11-26 16:42:00 -08:00

Source files for standard library extension modules,
and former extension modules that are now builtin modules.