Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update _MorselDictType for version compatibility
Refactor _MorselDictType to conditionally include 'partitioned' field for Python 3.14 and above.
  • Loading branch information
guoci authored Nov 29, 2025
commit c69bc81e31833127ab5b6cf54a7693f3efedb2f5
39 changes: 26 additions & 13 deletions stdlib/http/cookies.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,50 @@

class CookieError(Exception): ...

@type_check_only
class _MorselDictType(TypedDict):
expires: Any
path: Any
comment: Any
domain: Any
max_age: Any
secure: Any
httponly: Any
version: Any
samesite: Any
if sys.version_info >= (3, 14):
partitioned: Any
if sys.version_info >= (3, 14):
@type_check_only
class _MorselDictType(TypedDict):
expires: Any
path: Any
comment: Any
domain: Any
max_age: Any
secure: Any
httponly: Any
version: Any
samesite: Any
partitioned: Any # New in version 3.14.
else:
@type_check_only
class _MorselDictType(TypedDict):
expires: Any
path: Any
comment: Any
domain: Any
max_age: Any
secure: Any
httponly: Any
version: Any
samesite: Any


class Morsel(_MorselDictType, Generic[_T]):
@property

Check failure on line 51 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def value(self) -> str: ...
@property

Check failure on line 53 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def coded_value(self) -> _T: ...
@property

Check failure on line 55 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def key(self) -> str: ...
def __init__(self) -> None: ...

Check failure on line 57 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def set(self, key: str, val: str, coded_val: _T) -> None: ...

Check failure on line 58 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def setdefault(self, key: str, val: str | None = None) -> str: ...

Check failure on line 59 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
# The dict update can also get a keywords argument so this is incompatible
@overload # type: ignore[override]

Check failure on line 61 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def update(self, values: Mapping[str, str]) -> None: ...
@overload

Check failure on line 63 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def update(self, values: Iterable[tuple[str, str]]) -> None: ...
def isReservedKey(self, K: str) -> bool: ...

Check failure on line 65 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:") -> str: ...

Check failure on line 66 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
__str__ = output
def js_output(self, attrs: list[str] | None = None) -> str: ...
def OutputString(self, attrs: list[str] | None = None) -> str: ...
Expand Down
Loading