Author serhiy.storchaka
Recipients gvanrossum, kj, serhiy.storchaka
Date 2021-07-16.15:24:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I started reviewing and rewriting Objects/unionobject.c several weeks ago. Some discovered bugs were reported and fixed in separate issues: issue44606, issue44632, issue44635, issue44636, issue44646, issue44652. Before fixing the remaining bugs (issue44633, issue44642, issue44653) I want to merge some minor changes:

* Rename _Py_UnionType to _PyUnion_Type. It is how PyTypeObject instances are named.
* Add _PyUnion_Check() and _PyGenericAlias_Check(). It simplified the code.
* Do not expose _Py_Union(). It is only used locally.
* Move declarations of _Py_make_parameters and _Py_subs_parameters from genericaliasobject.h to internal/pycore_unionobject.h. They are for internal use only.
* Fix a possible leak in dedup_and_flatten_args().
* Significantly simplify union_richcompare(). The Python implementation can be used for comparing types.Union with typing.Union.
* Perform cheaper tests before more expensive tests in is_unionable().
* Optimize __module__ look up in is_typing_module() and support types without __module__.
* Fix outdated comments.
* Minor style fixes.
* Extract related tests to separate class.
* Make some tests more accurate: they should test for TypeError only specific operators, not constructors.

I am going to backport these changes to 3.10 to make backporting of future fixes easier.
Date User Action Args
2021-07-16 15:24:47serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, kj
2021-07-16 15:24:47serhiy.storchakasetmessageid: <>
2021-07-16 15:24:47serhiy.storchakalinkissue44654 messages
2021-07-16 15:24:46serhiy.storchakacreate