From 31a7a7390578dd41fbe0e76b394d4bca8a719855 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Mon, 20 Feb 2023 18:44:51 +0000 Subject: [PATCH] Fix an unnecessary allowlist entry in `ssl.pyi` --- stdlib/ssl.pyi | 5 ++++- tests/stubtest_allowlists/py3_common.txt | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index bbf8a4c6d65a..b73573dd5112 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -291,11 +291,14 @@ ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: AlertDescription ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: AlertDescription ALERT_DESCRIPTION_USER_CANCELLED: AlertDescription -class _ASN1Object(NamedTuple): +class _ASN1ObjectBase(NamedTuple): nid: int shortname: str longname: str oid: str + +class _ASN1Object(_ASN1ObjectBase): + def __new__(cls, oid: str) -> Self: ... @classmethod def fromnid(cls, nid: int) -> Self: ... @classmethod diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index fd28c8cf1854..319493b849b0 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -169,8 +169,7 @@ socketserver.BaseServer.RequestHandlerClass # is defined as a property, because socketserver.BaseServer.fileno # implemented in derived classes socketserver.BaseServer.get_request # implemented in derived classes socketserver.BaseServer.server_bind # implemented in derived classes -ssl.Purpose.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple. -ssl._ASN1Object.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple. +ssl.Purpose.__new__ # the multiple inheritance confuses mypy (sys.get_int_max_str_digits)? # Added in a patch release, backported to all security branches, but has yet to find its way to all GitHub Actions images sys.implementation # Actually SimpleNamespace but then you wouldn't have convenient attributes (sys.set_int_max_str_digits)? # Added in a patch release, backported to all security branches, but has yet to find its way to all GitHub Actions images