8000 TypedDict(...) as function does not respect "total" when setting __required_keys__ and __optional_keys__ · Issue #761 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

TypedDict(...) as function does not respect "total" when setting __required_keys__ and __optional_keys__ #761

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

Closed
agronholm opened this issue Oct 17, 2020 · 2 comments · Fixed by #778

Comments

@agronholm
Copy link
Contributor

Issue on Python bug tracker: https://bugs.python.org/issue42059

@domdfcoding
Copy link
Contributor

The fix has now been merged in CPython. The relevant lines that would need changing in typing_extensions are 1646 and 1654:

ns = {'__annotations__': dict(fields), '__total__': total}
try:
# Setting correct module is necessary to make typed dict classes pickleable.
ns['__module__'] = sys._getframe(1).f_globals.get('__name__', '__main__')
except (AttributeError, ValueError):
pass
return _TypedDictMeta(typename, (), ns)

@gvanrossum
Copy link
Member

Do you think you can submit a PR for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0