Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 835498 - dev-python/imapclient doesn't work with python3.10 (ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context)
Summary: dev-python/imapclient doesn't work with python3.10 (ssl.SSLError: Cannot crea...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL: https://github.com/mjs/imapclient/iss...
Whiteboard:
Keywords:
Depends on:
Blocks: py310, python3.10-compat
  Show dependency tree
 
Reported: 2022-03-17 10:22 UTC by Helmut Jarausch
Modified: 2022-06-21 05:48 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Jarausch 2022-03-17 10:22:20 UTC
In my private fetchmail Python script, I use
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.set_ciphers('AES256-SHA')

server = IMAPClient(HOST, ssl_context=ssl_context, use_uid=True, ssl=ssl)

This works just fine with Python3.9 and below.

But with Python3.10 I get

Traceback (most recent call last):
  File "/home/jarausch/bin/fetchmail_Skynet", line 171, in <module>
    server = IMAPClient(HOST, ssl_context=ssl_context, use_uid=True, ssl=ssl)
  File "/usr/lib/python3.10/site-packages/imapclient/imapclient.py", line 284, in __init__
    self._imap = self._create_IMAP4()
  File "/usr/lib/python3.10/site-packages/imapclient/imapclient.py", line 321, in _create_IMAP4
    return tls.IMAP4_TLS(
  File "/usr/lib/python3.10/site-packages/imapclient/tls.py", line 44, in __init__
    imaplib.IMAP4.__init__(self, host, port)
  File "/usr/lib/python3.10/imaplib.py", line 202, in __init__
    self.open(host, port, timeout)
  File "/usr/lib/python3.10/site-packages/imapclient/tls.py", line 52, in open
    self.sock = wrap_socket(sock, self.ssl_context, host)
  File "/usr/lib/python3.10/site-packages/imapclient/tls.py", line 32, in wrap_socket
    return ssl_context.wrap_socket(sock, server_hostname=host)
  File "/usr/lib/python3.10/ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.10/ssl.py", line 1061, in _create
    self._sslobj = self._context._wrap_socket(
ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:805)


Many thanks for some hints on what has changed in Python3.10 here.
Helmut
Comment 1 Larry the Git Cow gentoo-dev 2022-06-21 05:48:07 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d03a3b62fd6d8a615a20ef4424a6e031be2b5fe

commit 6d03a3b62fd6d8a615a20ef4424a6e031be2b5fe
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-21 05:47:10 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-21 05:47:47 +0000

    dev-python/imapclient: fix Python 3.10+
    
    Closes: https://bugs.gentoo.org/835498
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-python/imapclient/Manifest                     |  1 +
 .../files/imapclient-2.2.0-ssl-context.patch       | 13 +++++++++
 dev-python/imapclient/imapclient-2.2.0-r1.ebuild   | 31 ++++++++++++++++++++++
 3 files changed, 45 insertions(+)