bpo-28556: Don't simplify unions at runtime (GH-6841)

This commit is contained in:
Ivan Levkivskyi 2018-05-18 16:00:38 -07:00 committed by GitHub
parent 5634331a76
commit f65e31fee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 45 deletions

View file

@ -961,16 +961,15 @@ The module defines the following classes, functions and decorators:
Union[int, str] == Union[str, int]
* When a class and its subclass are present, the latter is skipped, e.g.::
Union[int, object] == object
* You cannot subclass or instantiate a union.
* You cannot write ``Union[X][Y]``.
* You can use ``Optional[X]`` as a shorthand for ``Union[X, None]``.
.. versionchanged:: 3.7
Don't remove explicit subclasses from unions at runtime.
.. data:: Optional
Optional type.