Skip to content

Commit ba6dbf4

Browse files
authored
[urllib] Deprecate addinfourl methods (#15291)
1 parent 7c0301e commit ba6dbf4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/urllib/response.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ from collections.abc import Callable, Iterable
44
from email.message import Message
55
from types import TracebackType
66
from typing import IO, Any
7+
from typing_extensions import deprecated
78

89
__all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"]
910

@@ -32,9 +33,13 @@ class addinfo(addbase):
3233

3334
class addinfourl(addinfo):
3435
url: str
35-
code: int | None
36+
code: int | None # Deprecated since Python 3.9. Use `addinfourl.status` attribute instead.
3637
@property
3738
def status(self) -> int | None: ...
3839
def __init__(self, fp: IO[bytes], headers: Message, url: str, code: int | None = None) -> None: ...
40+
@deprecated("Deprecated since Python 3.9. Use `addinfourl.url` attribute instead.")
3941
def geturl(self) -> str: ...
42+
@deprecated("Deprecated since Python 3.9. Use `addinfourl.headers` attribute instead.")
43+
def info(self) -> Message: ...
44+
@deprecated("Deprecated since Python 3.9. Use `addinfourl.status` attribute instead.")
4045
def getcode(self) -> int | None: ...

0 commit comments

Comments
 (0)