Skip to content
New issue

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

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

Already on GitHub? # to your account

bpo-42059: Fixed required/optional keys with old-style TypedDict #22736

Merged
merged 3 commits into from
Dec 10, 2020

Conversation

agronholm
Copy link
Contributor

@agronholm agronholm commented Oct 17, 2020

The TypedDict() function now passes the value of total as a metaclass argument instead of putting it directly in the attribute namespace.

https://bugs.python.org/issue42059

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience, and for taking the time to fix this @agronholm!

This looks good; I just have have some suggestions to clarify the NEWS entry a bit:

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@brandtbucher
Copy link
Member

Note to self: the 3.8 backport will need to be done manually, since TypedDict was refactored a bit in 3.9.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
@brandtbucher
Copy link
Member

Thanks!

@ambv, am I correct in assuming that the 3.8 backport should not be merged until 3.8.7 is released in ~2 weeks?

@brandtbucher brandtbucher merged commit 67b769f into python:master Dec 10, 2020
@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖

@brandtbucher
Copy link
Member

Hm, looks like the bot is stuck. I'm going to try removing and re-adding the backport labels.

@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@Mariatta Mariatta removed the needs backport to 3.9 only security fixes label Dec 13, 2020
@Mariatta Mariatta added the needs backport to 3.9 only security fixes label Dec 13, 2020
@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@Mariatta Mariatta added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Dec 13, 2020
@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-23747 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 13, 2020
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 13, 2020
…pythonGH-22736)

(cherry picked from commit 67b769f)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
brandtbucher pushed a commit that referenced this pull request Dec 14, 2020
…GH-22736) (GH-23747)

(cherry picked from commit 67b769f)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
@miss-islington
Copy link
Contributor

Thanks @agronholm for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @agronholm and @brandtbucher, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 67b769f5157c9dad1c7dd6b24e067b9fdab5b35d 3.8

@brandtbucher
Copy link
Member

🤦🏼 It looks like __required_keys__ and __optional_keys__ are new in 3.9, so no backport to 3.8 is needed.

RobertCraigie added a commit to RobertCraigie/prisma-client-py that referenced this pull request Nov 13, 2021
On Python 3.9.0 and Python 3.9.1, `typing.TypedDict` does not correctly hold the `__required_keys__` and `__optional_keys__` attributes, the fix (python/cpython#22736) for this issue was merged on 10/12/2020 and Python 3.9.1 was released on 8/12/2020, as such, the minimum Python version that does not require the use of `typing-extensions` is Python 3.9.2

However, writing our imports this way breaks mypy, reporting 1651 errors :)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants