GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. by Daraan · Pull Request #130460 · python/cpython

Conversation

@Daraan

@Daraan Daraan commented Feb 22, 2025

Copy link
Copy Markdown
Contributor

#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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Daraan
test: Assignment to a __total__ key in class body
27af527
In relation to python#109544 which changed this behavior.

Signed-off-by: Daniel Sperber <[email protected]>
@Daraan
Daraan requested review from AlexWaygood and JelleZijlstra as code owners February 22, 2025 16:17
@bedevere-app

bedevere-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Feb 22, 2025
@Daraan
style: run pre-commit
2e7d1d8
@bedevere-app

bedevere-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed Feb 22, 2025
View reviewed changes
Comment thread Lib/test/test_typing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@JelleZijlstra JelleZijlstra added skip issue skip news needs backport to 3.13 only security fixes labels Feb 22, 2025
JelleZijlstra
JelleZijlstra approved these changes Feb 22, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Feb 22, 2025
picnixz
picnixz approved these changes Feb 22, 2025
View reviewed changes
@Daraan
Merge branch 'main' into TypedDictWith__total__
7ca2af9
Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
@Daraan
backport of python/cpython#130460
5baef32
Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
@Daraan
backport of python/cpython#130460
0c9ef48
@Daraan Daraan mentioned this pull request Feb 22, 2025
Remove unnecessary hasattr check from TypedDict python/typing_extensions#533
Merged
Daraan added a commit to Daraan/typing_extensions that referenced this pull request Feb 22, 2025
@Daraan
backport of python/cpython#130460
e2abebf
@JelleZijlstra
JelleZijlstra merged commit d8ce092 into python:main Feb 22, 2025
@miss-islington-app

miss-islington-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 22, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 22, 2025
@Daraan @miss-islington
Add test checking value of a TypedDict's __total__ attribute when the…
78b0da8
…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 <[email protected]>
Signed-off-by: Daniel Sperber <[email protected]>
@bedevere-app

bedevere-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Feb 22, 2025
JelleZijlstra pushed a commit that referenced this pull request Feb 22, 2025
@miss-islington @Daraan
[3.13] Add test checking value of a TypedDict's __total__ attribute w…
6abec03
…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 <[email protected]>
Co-authored-by: Daraan <[email protected]>
@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

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@picnixz picnixz picnixz approved these changes
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood AlexWaygood is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip issue skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Daraan @JelleZijlstra @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.