Message396320
A possible simple fix is to change these lines https://github.com/python/cpython/blob/main/Objects/unionobject.c#L294-L301
to:
```
return (
is_typevar(obj) |
is_new_type(obj) |
is_special_form(obj) |
PyType_Check(obj) |
PyObject_TypeCheck(obj, &Py_GenericAliasType) |
(int)(type == &_Py_UnionType));
```
However, that may slow down union a little since we lose the short-circuiting that `||` provides over `|`, and all checks have to be evaluated.
Checking each result individually and mimicking the short circuiting behavior works too, so I did that. What do you think Serhiy? |
|
Date |
User |
Action |
Args |
2021-06-22 11:11:10 | kj | set | recipients:
+ kj, serhiy.storchaka |
2021-06-22 11:11:10 | kj | set | messageid: <1624360270.42.0.130260751731.issue44483@roundup.psfhosted.org> |
2021-06-22 11:11:10 | kj | link | issue44483 messages |
2021-06-22 11:11:10 | kj | create | |
|