Message397635
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:47 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, kj |
2021-07-16 15:24:47 | serhiy.storchaka | set | messageid: <1626449087.45.0.570024736737.issue44654@roundup.psfhosted.org> |
2021-07-16 15:24:47 | serhiy.storchaka | link | issue44654 messages |
2021-07-16 15:24:46 | serhiy.storchaka | create | |
|