Skip to content

Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. #130460

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

Merged
merged 3 commits into from
Feb 22, 2025

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Feb 22, 2025

#109544 introduced a change in an out of spec usage when a value is assigned to __total__ in the class body.

In such a case the assigned value is currently overwritten. Added a test cast for verification (asked by @JelleZijlstra).

Related comments from typing_extensions
python/typing_extensions#519 (comment)
python/typing_extensions#519 (comment)

In relation to python#109544 which changed this behavior.

Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
@bedevere-app
Copy link

bedevere-app bot commented Feb 22, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app bedevere-app bot added tests Tests in the Lib/test dir awaiting review labels Feb 22, 2025
@bedevere-app
Copy link

bedevere-app bot commented Feb 22, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
@JelleZijlstra JelleZijlstra merged commit d8ce092 into python:main Feb 22, 2025
38 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 22, 2025
…re is an assignment in the class body. (pythonGH-130460)

In relation to pythonGH-109544 which changed this behavior.
(cherry picked from commit d8ce092)

Co-authored-by: Daraan <github.blurry@9ox.net>
Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
@bedevere-app
Copy link

bedevere-app bot commented Feb 22, 2025

GH-130462 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 22, 2025
JelleZijlstra pushed a commit that referenced this pull request Feb 22, 2025
…hen there is an assignment in the class body. (GH-130460) (#130462)

Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (GH-130460)

In relation to GH-109544 which changed this behavior.
(cherry picked from commit d8ce092)

Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
Co-authored-by: Daraan <github.blurry@9ox.net>
@Daraan Daraan deleted the TypedDictWith__total__ branch February 22, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants