Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add recv test
  • Loading branch information
ashm-dev committed Apr 15, 2026
commit 32d0e37dd04376d2dec379af53076499600ad185
18 changes: 18 additions & 0 deletions Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,24 @@ def test_send_clears_stale_openssl_error_queue(self):

self.assertEqual(lib.ERR_peek_last_error(), 0)

@unittest.skipIf(ctypes is None, "requires ctypes")
def test_recv_clears_stale_openssl_error_queue(self):
with test_wrap_socket(socket.socket(socket.AF_INET),
cert_reqs=ssl.CERT_REQUIRED,
ca_certs=SIGNING_CA) as s:
s.connect(self.server_addr)

s.send(b"x")

lib = _get_openssl_error_lib()
_prime_openssl_sys_error_queue(lib, errno.EPIPE)
self.assertNotEqual(lib.ERR_peek_last_error(), 0)

data = s.recv(1)

self.assertEqual(data, b"x")
self.assertEqual(lib.ERR_peek_last_error(), 0)

def test_connect_with_context(self):
# Same as test_connect, but with a separately created context
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
Expand Down
Loading