Skip to content

Use PEP 604 in types.pyi #5553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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`
Expand Down
12 changes: 6 additions & 6 deletions stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down