stephen-bunn/file-config

is_regex_type raises AttributeError when evaluating typing types

Closed this issue · 2 comments

Current Behavior

Building a schema for a config which mixes both file_config.Regex types and typing.List types can sometimes cause AttributeError on type_.__name__ checks for is_regex_type.

Possible Solution

This is an edge case which can be fixed by just having a statement which enforces that all types sent to is_regex_type cannot be typing types.

Steps to Reproduce (for bugs)

  1. Create a config which uses var(List[str]) and var(file_config.Regex)
  2. Edge case only occurs when Regex is evaluated before List which casues lru_cache to try and use is_regex_type again

Your Environment

  • File Config Version: 0.3.2
  • Python Version: 3.7
  • Operating System and Version: Ubuntu 18.04

❤️ Thank you!

The fix provided in d3590b9 is not valid as typing.Regex is a generated typing type.

Most likely fixed in aada2af