FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-119180: PEP 649: Add __annotate__ attributes by JelleZijlstra · Pull Request #119209 · python/cpython · GitHub

/ cpython Public

gh-119180: PEP 649: Add __annotate__ attributes - #119209

Merged
ambv merged 11 commits into
python:mainfrom
JelleZijlstra:pep649-anno
May 22, 2024
Merged

gh-119180: PEP 649: Add __annotate__ attributes#119209
ambv merged 11 commits into
python:mainfrom
JelleZijlstra:pep649-anno

Conversation

JelleZijlstra commented May 20, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

This implements https://peps.python.org/pep-0649/#annotate-and-annotations. In separate PRs I will work on making the compiler synthesize __annotate__ functions.

JelleZijlstra changed the title PEP 649: Add __annotate__ attributes gh-119180: PEP 649: Add __annotate__ attributes May 20, 2024
bedevere-app Bot mentioned this pull request May 20, 2024
30 tasks
JelleZijlstra requested a review from ambv May 20, 2024 15:41
AlexWaygood removed their request for review May 20, 2024 21:24

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some comments. I'm wondering whether the error message "annotate returned a non-dict" could be changed to "annotate must return a dict" or "did not return a dict"

Comment thread Objects/moduleobject.c Outdated
Comment thread Objects/moduleobject.c
Comment thread Objects/moduleobject.c Outdated

Copy link
Copy Markdown
Member Author

Some comments. I'm wondering whether the error message "annotate returned a non-dict" could be changed to "annotate must return a dict" or "did not return a dict"

For comparison:

>>> iter(X())
Traceback (most recent call last):
  File "<python-input-4>", line 1, in <module>
    iter(X())
    ~~~~^^^^^
TypeError: iter() returned non-iterator of type 'int'

I think I'll make the __annotate__ errors similar.

carljm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good in general, a few comments.

I would prefer to remove the "set __annotate__ to None" behavior; I guess we would have to ask the Steering Council about that. Maybe not worth it unless we see it causing confusion in practice.

Comment thread Objects/funcobject.c Outdated
Comment thread Objects/funcobject.c Outdated
Comment thread Objects/typeobject.c Outdated
Comment thread Objects/typeobject.c Outdated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL