Public bug reported:
typing in the Python 3.5.2 stdlib tracebacks when passing Type to a
Union (of which Optional is a specific case). (This is typing bug #266:
https://github.com/python/typing/issues/266.)
(This is particularly annoying because as a stdlib library, the fix
released by upstream to PyPI can't easily be used even via pip.)
Steps to Reproduce
==================
```
lxc launch ubuntu:x reproducer
lxc exec reproducer -- python3 -c "from typing import Optional, Type;
Optional[Type[BaseException]]"
```
Expected Behaviour
==================
No output, exits 0.
Actual Behaviour
================
```
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.5/typing.py", line 649, in __getitem__
return Union[arg, type(None)]
File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/usr/lib/python3.5/typing.py", line 512, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__
if super().__subclasscheck__(cls):
File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__
for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
```
** Affects: python3.5 (Ubuntu)
Importance: Undecided
Status: New
** Affects: python3.5 (Ubuntu Xenial)
Importance: Undecided
Status: New
** Affects: python3.5 (Ubuntu Yakkety)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1704473
Title:
Traceback when using typing.Optional[Type] on xenial
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.5/+bug/1704473/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs