diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ed574f..4d01dda 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "3.14" - "pypy-3.9" steps: - uses: actions/checkout@v3 diff --git a/README.rst b/README.rst index 33f6f96..193cc13 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ library. ========================= ======================================== Current version 3.0.1 -Supported Python versions 3.8 - 3.13 +Supported Python versions 3.8 - 3.14 License New BSD Project home https://github.com/mjs/imapclient/ PyPI https://pypi.python.org/pypi/IMAPClient diff --git a/doc/src/index.rst b/doc/src/index.rst index 9c82b58..0c118d8 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -30,7 +30,7 @@ explains IMAP in detail. Other RFCs also apply to various extensions to the base protocol. These are referred to in the documentation below where relevant. -Python versions 3.8 through 3.13 are officially supported. +Python versions 3.8 through 3.14 are officially supported. Getting Started --------------- diff --git a/imapclient/tls.py b/imapclient/tls.py index fe9671e..acdc6dd 100644 --- a/imapclient/tls.py +++ b/imapclient/tls.py @@ -8,7 +8,6 @@ """ import imaplib -import io import socket import ssl from typing import Optional, TYPE_CHECKING @@ -35,34 +34,15 @@ class IMAP4_TLS(imaplib.IMAP4): def __init__( self, host: str, - port: int, - ssl_context: Optional[ssl.SSLContext], + port: int = 993, + ssl_context: Optional[ssl.SSLContext] = None, timeout: Optional[float] = None, ): self.ssl_context = ssl_context self._timeout = timeout - imaplib.IMAP4.__init__(self, host, port) - self.file: io.BufferedReader + super().__init__(host, port) - def open( - self, host: str = "", port: int = 993, timeout: Optional[float] = None - ) -> None: - self.host = host - self.port = port - sock = socket.create_connection( - (host, port), timeout if timeout is not None else self._timeout - ) - self.sock = wrap_socket(sock, self.ssl_context, host) - self.file = self.sock.makefile("rb") + def _create_socket(self, timeout: Optional[float]) -> socket.socket: + sock = socket.create_connection((self.host, self.port), timeout=timeout) - def read(self, size: int) -> bytes: - return self.file.read(size) - - def readline(self) -> bytes: - return self.file.readline() - - def send(self, data: "Buffer") -> None: - self.sock.sendall(data) - - def shutdown(self) -> None: - imaplib.IMAP4.shutdown(self) + return wrap_socket(sock, self.ssl_context, self.host) \ No newline at end of file