[Bug 1650202] Re: issubclass(a_type, union_type) has stopped working
Brian Morton
rokclimb15 at gmail.com
Fri Jan 13 19:09:17 UTC 2017
This is expected behavior from upstream changes.
https://github.com/python/typing/commit/7baf6fe2a6d96ab09c807aac174650baa35d15dd
Optional is shorthand for Union, and Union cannot be subclassed. This
behavior "worked" before, but was undefined and returned unpredictable
results.
** Changed in: python3.5 (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.5 in Ubuntu.
https://bugs.launchpad.net/bugs/1650202
Title:
issubclass(a_type, union_type) has stopped working
Status in python3.5 package in Ubuntu:
Invalid
Bug description:
issubclass(a_type, union_type) has stopped working:
In zesty:
# python3
Python 3.5.2+ (default, Dec 13 2016, 14:16:35)
[GCC 6.2.1 20161212] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> issubclass(str, typing.Optional[str])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/typing.py", line 770, in __subclasscheck__
raise TypeError("Unions cannot be used with issubclass().")
TypeError: Unions cannot be used with issubclass().
In yakkety:
$ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> issubclass(str, typing.Optional[str])
True
ProblemType: Bug
DistroRelease: Ubuntu 17.04
Package: python3.5 3.5.2-9
ProcVersionSignature: Ubuntu 4.8.0-30.32-generic 4.8.6
Uname: Linux 4.8.0-30-generic x86_64
ApportVersion: 2.20.3-0ubuntu8
Architecture: amd64
Date: Thu Dec 15 09:58:29 2016
ProcEnviron:
TERM=screen.xterm-256color
PATH=(custom, no user)
SourcePackage: python3.5
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.5/+bug/1650202/+subscriptions
More information about the foundations-bugs
mailing list