Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when annotating arguments with Optional[Dict] #269

Closed
jni opened this issue Aug 5, 2021 · 1 comment · Fixed by #270
Closed

Error when annotating arguments with Optional[Dict] #269

jni opened this issue Aug 5, 2021 · 1 comment · Fixed by #270
Labels
bug Something isn't working

Comments

@jni
Copy link
Contributor

jni commented Aug 5, 2021

Describe the bug

I don't have a minimum reproducible example yet. I don't think it'll be hard to produce but wanted to get something written down. When annotating an argument with "Optional[Dict] = None", I get an error from issubclass in this line:

https://github.com/napari/magicgui/blob/481f665af1992c0c99eabe4d608e1d0b6da78e54/magicgui/type_map.py#L85-L86

It tries to evaluate issubclass(typing.Dict, type(None)), which fails with:

TypeError: issubclass() arg 1 must be a class

Changing the annotation to Optional[dict] (no typing) bypasses the error.

Environment:

  • OS: Mac
  • backend: PyQt5
  • magicgui version 0.2.10/master
@jni jni added the bug Something isn't working label Aug 5, 2021
@tlambert03
Copy link
Member

ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants