Skip to content

Commit 51d8019

Browse files
authored
Merge branch 'main' into cachetools
2 parents 975aff4 + c7d0fd9 commit 51d8019

File tree

24 files changed

+625
-609
lines changed

24 files changed

+625
-609
lines changed

stdlib/@tests/test_cases/check_types.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import sys
44
import types
55
from collections import UserDict
6-
from typing import Union
6+
from typing import Any, Literal, TypeVar, Union
77
from typing_extensions import assert_type
88

9+
_T = TypeVar("_T")
10+
911
# test `types.SimpleNamespace`
1012

1113
# Valid:
@@ -58,3 +60,13 @@ def foo(self, value: int) -> None:
5860
@foo.deleter
5961
def foo(self) -> None:
6062
self._value = None
63+
64+
65+
if sys.version_info > (3, 10):
66+
union_type = int | list[_T]
67+
68+
# ideally this would be `_SpecialForm` (Union)
69+
assert_type(union_type | Literal[1], types.UnionType | Any)
70+
# Both mypy and pyright special-case this operation,
71+
# but in different ways, so we just check that no error is emitted:
72+
_ = union_type[int]

stdlib/dbm/sqlite3.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ class _Database(MutableMapping[bytes, bytes]):
2626
def __enter__(self) -> Self: ...
2727
def __exit__(self, *args: Unused) -> None: ...
2828

29-
def open(filename: StrOrBytesPath, /, flag: Literal["r", "w,", "c", "n"] = "r", mode: int = 0o666) -> _Database: ...
29+
def open(filename: StrOrBytesPath, /, flag: Literal["r", "w", "c", "n"] = "r", mode: int = 0o666) -> _Database: ...

0 commit comments

Comments
 (0)