You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee='https://github.com/serhiy-storchaka'closed_at=<Date2021-06-23.09:44:11.996>created_at=<Date2021-06-22.06:32:26.859>labels= ['interpreter-core', '3.10', 'type-crash', '3.11']
title='Fatal error in type union'updated_at=<Date2021-06-23.09:55:58.266>user='https://github.com/serhiy-storchaka'
Fatal Python error: _Py_CheckSlotResult: Slot | of type type succeeded with an exception set
Python runtime state: initialized
Traceback (most recent call last):
File "<stdin>", line 4, in __module__ZeroDivisionError: division by zero
Aborted (core dumped)
The problem in Objects/unionobject.c is that is_typing_module() (and therefore is_typevar() and is_special_form()) can return not only 0 and 1, but -1 as a signal of error, but is_unionable() does not check results for error and interprets it as boolean true.
Yes, Checking each result individually is a right way. Not only because performance, but because calling any Python code while an error is set will cause a crash in debug build and weird bugs in release build. It is better to return as fast as you have an error.