From 6a92ae6295dbc4517abc375830d123c65f1b2cc4 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 11 Oct 2019 14:56:19 +0200 Subject: [PATCH] Change type for urllib headers from Mapping to email.message.Message (#3345) Also remove override of 'headers' in HTTPError Closes #3344 --- stdlib/3/urllib/error.pyi | 1 - stdlib/3/urllib/response.pyi | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/3/urllib/error.pyi b/stdlib/3/urllib/error.pyi index 191c765ed..16ceae8fc 100644 --- a/stdlib/3/urllib/error.pyi +++ b/stdlib/3/urllib/error.pyi @@ -7,6 +7,5 @@ class URLError(IOError): reason: Union[str, BaseException] class HTTPError(URLError, addinfourl): code: int - headers: Dict[str, str] def __init__(self, url, code, msg, hdrs, fp) -> None: ... class ContentTooShortError(URLError): ... diff --git a/stdlib/3/urllib/response.pyi b/stdlib/3/urllib/response.pyi index 7cbc045a3..dca0efacc 100644 --- a/stdlib/3/urllib/response.pyi +++ b/stdlib/3/urllib/response.pyi @@ -1,6 +1,7 @@ # private module, we only expose what's needed from typing import BinaryIO, Iterable, List, Mapping, Optional, Type, TypeVar +from email.message import Message from types import TracebackType _AIUT = TypeVar("_AIUT", bound=addbase) @@ -31,8 +32,8 @@ class addbase(BinaryIO): def writelines(self, lines: Iterable[bytes]) -> None: ... class addinfo(addbase): - headers: Mapping[str, str] - def info(self) -> Mapping[str, str]: ... + headers: Message + def info(self) -> Message: ... class addinfourl(addinfo): url: str