[New-bugs-announce] [issue29246] typing.Union raises RecursionError when comparing Union to other type
Spiro Sideris
report at bugs.python.org
Wed Jan 11 18:03:00 EST 2017
New submission from Spiro Sideris:
The typing.Union module raises a RecursionError when comparing a Union with no additional tree_args to a type that is not a Union.
An example of the stack trace with the added test looks like the following:
0:00:00 [1/1] test_typing
test test_typing failed -- Traceback (most recent call last):
File "/Users/spiro/Development/open_source/cpython/Lib/test/test_typing.py", line 221, in test_union_compare_other
self.assertNotEqual(Union, object)
File "/Users/spiro/Development/open_source/cpython/Lib/unittest/case.py", line 827, in assertNotEqual
if not first != second:
File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__
return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other
File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__
return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other
File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__
return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other
[Previous line repeated 233 more times]
File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 759, in __eq__
if not isinstance(other, _Union):
RecursionError: maximum recursion depth exceeded in __instancecheck__
test_typing failed
1 test failed:
test_typing
Total duration: 316 ms
Tests result: FAILURE
The test compares a Union with no tree_args to another type.
----------
components: Library (Lib)
files: spirowork.patch
keywords: patch
messages: 285279
nosy: spiside
priority: normal
severity: normal
status: open
title: typing.Union raises RecursionError when comparing Union to other type
type: crash
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46264/spirowork.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29246>
_______________________________________
More information about the New-bugs-announce
mailing list