diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 54433b23303b..fdcad75448bd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -140,8 +140,6 @@ Accepted features that *cannot* yet be used in typeshed include: - [PEP 585](https://www.python.org/dev/peps/pep-0585/) (builtin generics): see [#4820](https://github.com/python/typeshed/issues/4820), mostly supported but bugs remain for a few specific cases -- [PEP 604](https://www.python.org/dev/peps/pep-0604/) (Union - pipe operator): see [#4819](https://github.com/python/typeshed/issues/4819) - [PEP 612](https://www.python.org/dev/peps/pep-0612/) (ParamSpec): see [#4827](https://github.com/python/typeshed/issues/4827) - [PEP 613](https://www.python.org/dev/peps/pep-0613/) (TypeAlias): @@ -154,6 +152,8 @@ Supported features include: - [PEP 589](https://www.python.org/dev/peps/pep-0589/) (TypedDict) - [PEP 647](https://www.python.org/dev/peps/pep-0647/) (TypeGuard): see [#5406](https://github.com/python/typeshed/issues/5406) +- [PEP 604](https://www.python.org/dev/peps/pep-0604/) (Union + pipe operator): see [#4819](https://github.com/python/typeshed/issues/4819) Features from the `typing` module that are not present in all supported Python 3 versions must be imported from `typing_extensions` diff --git a/stdlib/types.pyi b/stdlib/types.pyi index e280150e3406..741d41d4ab79 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -34,9 +34,9 @@ class _Cell: cell_contents: Any class FunctionType: - __closure__: Optional[Tuple[_Cell, ...]] + __closure__: Tuple[_Cell, ...] | None __code__: CodeType - __defaults__: Optional[Tuple[Any, ...]] + __defaults__: Tuple[Any, ...] | None __dict__: Dict[str, Any] __globals__: Dict[str, Any] __name__: str @@ -47,12 +47,12 @@ class FunctionType: self, code: CodeType, globals: Dict[str, Any], - name: Optional[str] = ..., - argdefs: Optional[Tuple[object, ...]] = ..., - closure: Optional[Tuple[_Cell, ...]] = ..., + name: str | None = ..., + argdefs: Tuple[object, ...] | None = ..., + closure: Tuple[_Cell, ...] | None = ..., ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Optional[object], type: Optional[type]) -> MethodType: ... + def __get__(self, obj: object | None, type: type | None) -> MethodType: ... LambdaType = FunctionType