summaryrefslogtreecommitdiffstats
path: root/Objects/unionobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44662: Add ability to annotate types.Union (#27214)Yurii Karabas2021-07-291-1/+23
| | | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-44732: Rename types.Union to types.UnionType (#27342)Hasan2021-07-261-3/+3
| | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-44676: Serialize the union type using only public API (GH-27323)Serhiy Storchaka2021-07-241-48/+0
| | | | Remove also the _from_args() constructor.
* bpo-44676: Fix reference leaks in union_reduce (GH-27332)Pablo Galindo Salgado2021-07-241-1/+1
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-44731: Simplify the union type implementation (GH-27318)Serhiy Storchaka2021-07-241-81/+7
| | | Remove direct support of typing types in the C code because they are already supported by defining methods __or__ and __ror__ in the Python code.
* bpo-44676: Add ability to serialize types.Union (GH-27244)Yurii Karabas2021-07-231-0/+51
|
* bpo-44653: Support typing types in parameter substitution in the union type. ↵Serhiy Storchaka2021-07-221-13/+12
| | | | (GH-27247)
* bpo-44633: Fix parameter substitution of the union type with wrong types. ↵Serhiy Storchaka2021-07-181-16/+28
| | | | | | (GH-27218) A TypeError is now raised instead of returning NotImplemented.
* bpo-44654: Refactor and clean up the union type implementation (GH-27196)Serhiy Storchaka2021-07-171-88/+47
|
* bpo-44652: Preserve natural order of args in the union type. (GH-27185)Serhiy Storchaka2021-07-161-2/+2
|
* bpo-44636: Collapse union of equal types (GH-27178)Serhiy Storchaka2021-07-161-8/+16
| | | | | | The result of `int | int` is now `int`. Fix comparison of the union type with non-hashable objects. `int | str == {}` no longer raises a TypeError.
* bpo-44646: Fix the hash of the union type. (#27179)Serhiy Storchaka2021-07-161-4/+6
| | | | | | It no longer depends on the order of arguments. hash(int | str) == hash(str | int) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
* bpo-44632: Fix support of TypeVar in the union type (GH-27139)Serhiy Storchaka2021-07-141-1/+1
| | | | int | TypeVar('T') returns now an instance of types.Union instead of typing.Union.
* bpo-44635: Convert None to NoneType in the union type constructor (GH-27136)Serhiy Storchaka2021-07-141-9/+7
|
* bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. ↵Serhiy Storchaka2021-07-141-4/+19
| | | | | | | | | | (GH-27120) * Fix issubclass() for None. E.g. issubclass(type(None), int | None) returns now True. * Fix issubclass() for virtual subclasses. E.g. issubclass(dict, int | collections.abc.Mapping) returns now True. * Fix crash in isinstance() if the check for one of items raises exception.
* bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)Yurii Karabas2021-07-061-0/+53
| | | | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* bpo-44553: Correct failure in tp_new for the union object (GH-27008)Pablo Galindo2021-07-031-2/+2
|
* bpo-44553 : Implement GC methods for types.Union (GH-26993)Ken Jin2021-07-031-4/+17
|
* bpo-44483: Fix crash in union object with bad ``__module__`` (GH-26848)Ken Jin2021-06-221-3/+14
|
* bpo-42195: Disallow isinstance/issubclass for subclasses of genericaliases ↵Ken Jin2021-01-021-1/+1
| | | | | | | | | | | | | | in Union (GH-24059) Previously this didn't raise an error. Now it will: ```python from collections.abc import Callable isinstance(int, list | Callable[..., str]) ``` Also added tests in Union since there were previously none for stuff like ``isinstance(list, list | list[int])`` either. Backport to 3.9 not required. Automerge-Triggered-By: GH:gvanrossum
* bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and ↵kj2020-12-131-3/+3
| | | | typing (GH-23060)
* bpo-42233: Add union type expression support for GenericAlias and fix ↵kj2020-11-091-5/+15
| | | | de-duplicating of GenericAlias (GH-23077)
* bpo-42099: Fix reference to ob_type in unionobject.c and ceval (GH-22829)Neil Schemenauer2020-10-271-1/+1
| | | * Use Py_TYPE() rather than o->ob_type.
* bpo-41991: Remove _PyObject_HasAttrId (GH-22629)Serhiy Storchaka2020-10-101-6/+7
| | | It can silence arbitrary exceptions.
* bpo-41428: Fix compiler warning in unionobject.c (GH-22416)Victor Stinner2020-09-261-3/+3
| | | | | | | Use Py_ssize_t type rather than int, to store lengths in unionobject.c. Fix the warning: Objects\unionobject.c(205,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
* bpo-41428: Fix compiler warnings in unionobject.c (GH-22388)Victor Stinner2020-09-231-3/+3
| | | | | | | | | | | | | | | | Use Py_ssize_t type rather than int, to store lengths in unionobject.c. Fix warnings: Objects\unionobject.c(189,71): warning C4244: '+=': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(182,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(205,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(437,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
* bpo-41428: Implementation for PEP 604 (GH-21515)Maggie Moss2020-09-091-0/+464
See https://www.python.org/dev/peps/pep-0604/ for more information. Co-authored-by: Pablo Galindo <pablogsal@gmail.com>