Typcasting with typing._GenericAlias fails
Closed this issue · 1 comments
stephen-bunn commented
In some use cases typing types are considered to be typing._GenericAlias
subclasses instead of typing.GenericMeta
. In these cases the type.__extra__
attribute is not defined as it is not considered to be part of the typing
module. However the type.__origin__
attribute contains the same needed data.
(type.__args__
is the same no matter what)
This can be mitigated by trying __extra__
first (as that is the more likely scenario) and catching AttributeError
in order to then try and load the base type from type.__origin__
this bug appears on https://github.com/stephen-bunn/file-config/blob/master/src/file_config/utils.py#L370.
Your Environment
- File Config Version: 0.3.3
- Python Version: 3.7
- Operating System and Version: Ubuntu 18.04
❤️ Thank you!
stephen-bunn commented
Fixed in 3a386a4