Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

More fixes for 3.14 and 3.15#602

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 2 commits intopython:mainfromJelleZijlstra:nextrelease
May 24, 2025

Conversation

JelleZijlstra
Copy link
Member

python/cpython#133772 (TypedDict change)

python/cpython#133822 (NamedTuple change for 3.15)

Comment on lines +4407 to +4419
def _make_td(future, class_name, annos, base, extra_names=None):
lines = []
if future:
lines.append('from __future__ import annotations')
lines.append('from typing import TypedDict')
lines.append(f'class {class_name}({base}):')
for name, anno in annos.items():
lines.append(f' {name}: {anno}')
code = '\n'.join(lines)
ns = {**extra_names} if extra_names else {}
exec(code, ns)
return ns[class_name]

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is all very magical. Wouldn't it make more sense to just hard-code these four fairly short code samples?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, it's eight. So maybe use a template at least?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I feel that would be more complicated; it would require conditionals on half the lines of the template andtextwrap.dedent.

@JelleZijlstraJelleZijlstra merged commitec1876c intopython:mainMay 24, 2025
21 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@srittausrittausrittau approved these changes

@AlexWaygoodAlexWaygoodAwaiting requested review from AlexWaygood

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@JelleZijlstra@srittau

[8]ページ先頭

©2009-2025 Movatter.jp