Update poplib and smtplib for py312 (#10685)

This commit is contained in:
Alex Waygood
2023-09-08 18:42:03 +01:00
committed by GitHub
parent 53144ca572
commit c50a708818
8 changed files with 52 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import socket
import ssl
import sys
from builtins import list as _list # conflicts with a method named "list"
from re import Pattern
from typing import Any, BinaryIO, NoReturn, overload
@@ -51,14 +52,20 @@ class POP3:
def stls(self, context: ssl.SSLContext | None = None) -> bytes: ...
class POP3_SSL(POP3):
def __init__(
self,
host: str,
port: int = 995,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
context: ssl.SSLContext | None = None,
) -> None: ...
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...
if sys.version_info >= (3, 12):
def __init__(
self, host: str, port: int = 995, *, timeout: float = ..., context: ssl.SSLContext | None = None
) -> None: ...
def stls(self, context: Any = None) -> NoReturn: ...
else:
def __init__(
self,
host: str,
port: int = 995,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
context: ssl.SSLContext | None = None,
) -> None: ...
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...

View File

@@ -128,7 +128,13 @@ class SMTP:
def auth_plain(self, challenge: ReadableBuffer | None = None) -> str: ...
def auth_login(self, challenge: ReadableBuffer | None = None) -> str: ...
def login(self, user: str, password: str, *, initial_response_ok: bool = True) -> _Reply: ...
def starttls(self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None) -> _Reply: ...
if sys.version_info >= (3, 12):
def starttls(self, *, context: SSLContext | None = None) -> _Reply: ...
else:
def starttls(
self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None
) -> _Reply: ...
def sendmail(
self,
from_addr: str,
@@ -152,17 +158,29 @@ class SMTP_SSL(SMTP):
keyfile: str | None
certfile: str | None
context: SSLContext
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
if sys.version_info >= (3, 12):
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
*,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
else:
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
LMTP_PORT: int

View File

@@ -119,6 +119,7 @@ json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522

View File

@@ -69,6 +69,7 @@ functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
http.HTTPMethod.description # mutable instance attribute at runtime but we pretend it's a property
inspect._ParameterKind.description # Still exists, but stubtest can't see it
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
types.GenericAlias.__getattr__
types.GenericAlias.__mro_entries__

View File

@@ -6,9 +6,6 @@ enum.EnumType.__call__
enum.property.member
http.client.HTTPConnection.get_proxy_response_headers
imaplib.IMAP4_SSL.__init__
poplib.POP3_SSL.__init__
smtplib.SMTP.starttls
smtplib.SMTP_SSL.__init__
urllib.request.AbstractHTTPHandler.__init__
urllib.request.HTTPSHandler.__init__

View File

@@ -115,6 +115,7 @@ json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522

View File

@@ -95,6 +95,7 @@ json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522

View File

@@ -108,7 +108,6 @@ multiprocessing.synchronize.SemLock.release
numbers.Number.__hash__ # typeshed marks this as abstract but code just sets this as None
optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr
pickle.Pickler.reducer_override # implemented in C pickler
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pyexpat.expat_CAPI
select.poll # Depends on configuration
selectors.DevpollSelector # Depends on configuration