-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-119180: Use type descriptors to access annotations (PEP 749) #122074
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
JelleZijlstra
merged 140 commits into
python:main
from
JelleZijlstra:pep649-basedescriptor
Jul 27, 2024
Merged
Changes from all commits
Commits
Show all changes
140 commits
Select commit
Hold shift + click to select a range
985f8df
Add __annotate__ descriptors
JelleZijlstra c822ffa
fix refleaks
JelleZijlstra e80095e
blurb
JelleZijlstra 90ff2c4
Fix some tests
JelleZijlstra 026c0ff
regen globals
JelleZijlstra 7968744
Some initial work
JelleZijlstra 4e54197
Add bytecode for adding annotate
JelleZijlstra 4469b32
compiler changes
JelleZijlstra 47d672e
Functions work
JelleZijlstra ab9359c
Raise AssertionError on the wrong format
JelleZijlstra e65d55a
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra e50cd62
Modules and classes
JelleZijlstra afae5c0
attempts
JelleZijlstra e5a7b1a
Fixes
JelleZijlstra 3f26d44
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra 31a4471
Fix code object name
JelleZijlstra fbb1d88
Start fixing test_type_annotations
JelleZijlstra f452eb2
Fix class scoping
JelleZijlstra 8c4b4e3
unyielding
JelleZijlstra cbf9a3d
Fix test_typing
JelleZijlstra 5d182fc
Fix test_type_parmas
JelleZijlstra ce98c19
Add test, add to inspect
JelleZijlstra e0578fc
Use inspect constants
JelleZijlstra ed16167
test_grammar tweaks
JelleZijlstra f38de20
fix test_positional_only_arg
JelleZijlstra 87baca2
Fix test_module
JelleZijlstra 355d3df
Fix symtable tests
JelleZijlstra f9d81b6
fix test_pydoc
JelleZijlstra dd1f64a
fix test_traceback
JelleZijlstra 62f5b3b
fix test_opcodes
JelleZijlstra c5b308b
Some work on inspect
JelleZijlstra b66ad8b
Merge branch 'main' into pep649-compile
JelleZijlstra 1a63f5d
Raise NotImplementedError
JelleZijlstra 82c0dbc
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra a0c39b5
blurb
JelleZijlstra 083bbc5
Fix test_dis
JelleZijlstra de1b235
Remove broken tests
JelleZijlstra 1c98fe5
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra 5f5cf11
No deferred evaluation in interactive mode
JelleZijlstra 77f3b1c
gh-119443: Turn off from __future__ import annotations in REPL
JelleZijlstra 4217830
Fix refleak
JelleZijlstra 13f5d76
Fix another refleak
JelleZijlstra a121e1a
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra 242301c
Exit scope correctly on error
JelleZijlstra 239ba23
fix test
JelleZijlstra f9b3956
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra 787ad33
Update except
JelleZijlstra cfef2c6
Initialize field
JelleZijlstra b62e04c
Initialize field
JelleZijlstra c8a9294
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra 5ae206d
self-review
JelleZijlstra 24fd328
Fix crash found by CIFuzz
JelleZijlstra 520b647
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra 0f9d0c5
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra c181864
fix merge
JelleZijlstra 0befff5
Name the function as __annotate__
JelleZijlstra ada6573
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra ae7714c
Replace find_ann()
JelleZijlstra 431811a
fix test
JelleZijlstra 7ca24d3
Remove second compiler pass
JelleZijlstra 2ab5d07
Fix refleak
JelleZijlstra 3b4a645
Fix a test
JelleZijlstra 1dfd02b
Fix bug when there are only non-simple annotations
JelleZijlstra daba318
Fix more tests
JelleZijlstra 0daf0b1
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra b066b3d
Remove REPL special case
JelleZijlstra 7669361
no docstrings in the repl
JelleZijlstra f19060e
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra c6a1b80
Fix pyrepl test
JelleZijlstra 5cdbdd7
CR feedback
JelleZijlstra 636a636
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra 26c731b
New annotations module
JelleZijlstra 4d76723
run black on new modules
JelleZijlstra 9a7e130
Some work
JelleZijlstra ed79b40
Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS
JelleZijlstra db67ef4
Merge branch 'lfcg' into pep649-inspect
JelleZijlstra d5b23ff
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra 3e65032
Work on functools
JelleZijlstra e748feb
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra f0d430f
gh-119180: Lazily wrap annotations on classmethod and staticmethod
JelleZijlstra ad8c51c
Merge branch 'pep649-staticclassm' into pep649-inspect
JelleZijlstra c11cc6d
Use the new annotations module
JelleZijlstra a2b4f9e
Merge remote-tracking branch 'upstream/main' into pep649-compile
JelleZijlstra 672511a
update_wrapper() updates __annotate__, not __annotations__
JelleZijlstra 0f321c6
Expand test
JelleZijlstra 178dd92
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra c64aa73
new stdlib module name
JelleZijlstra 44d890e
More dataclass tests, fix get_annotations() bug
JelleZijlstra 7c21c6a
Fix some bugs
JelleZijlstra bd469ab
Still generate __annotate__ if "from __future__ import annotations" i…
JelleZijlstra a2c2075
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra 174aa47
Support for deferred evaluation of annotations in NamedTuple
JelleZijlstra cdcd8c8
Fix test
JelleZijlstra 62ff51c
TypedDict
JelleZijlstra 643b215
Move get_annotations tests
JelleZijlstra 278de22
Regen globals
JelleZijlstra 9215346
Fix test
JelleZijlstra 9fa0ad7
Merge branch 'pep649-compile' into pep649-inspect
JelleZijlstra 11a96f9
fix doctest
JelleZijlstra 613710b
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra af5231c
evaluate_forward_ref()
JelleZijlstra e525f01
Finish get_annotations() and extend tests
JelleZijlstra eabea74
Test and fix stringifier
JelleZijlstra 2dbe8ff
Closure support for SOURCE
JelleZijlstra 2b88471
More stringifier fixes
JelleZijlstra 406d3bc
del temporaries
JelleZijlstra ad91e5a
don't look
JelleZijlstra d9a6579
but why?
JelleZijlstra 7c8bb1d
Update test_typing test
JelleZijlstra 991798b
Reverse ops
JelleZijlstra 0e609f8
Reformat new module
JelleZijlstra 5f269c7
Remove unnecessary method
JelleZijlstra 39f969c
Error on unrecognized format
JelleZijlstra 8a21f29
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra 223e2d5
Add some tests, and explicit errors for some unsupported operations
JelleZijlstra 7afecca
I guess not
JelleZijlstra efce54f
Use __annotations__ directly for VALUE
JelleZijlstra 487ea34
Merge branch 'main' into pep649-compile
JelleZijlstra 06bf28a
Merge remote-tracking branch 'origin/pep649-compile' into pep649-inspect
JelleZijlstra 3d5244e
annotationlib
JelleZijlstra 09982e2
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra 62ed45f
Add blurb
JelleZijlstra 93a932d
Update functools
JelleZijlstra 7586ed1
Update Lib/typing.py
JelleZijlstra 064769a
Update Lib/annotationlib.py
JelleZijlstra 6e078fd
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra c8510ea
Review feedback
JelleZijlstra 9fd65bf
Add some tests
JelleZijlstra 5ec025b
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra 288fad9
unused imports
JelleZijlstra 2e376e0
fix test_annotationlib
JelleZijlstra 2a1c9a9
Fix tests
JelleZijlstra f60f435
Merge remote-tracking branch 'upstream/main' into pep649-inspect
JelleZijlstra 1f3a63c
Reapply #120272
JelleZijlstra c87cccd
gh-119180: Yet another approach for fixing metaclass annotations
JelleZijlstra 4a6f0b8
Merge branch 'main' into pep649-basedescriptor
JelleZijlstra 0cae78f
Merge remote-tracking branch 'upstream/main' into pep649-basedescriptor
JelleZijlstra 3eb222c
news
JelleZijlstra cb34d89
add a test
JelleZijlstra 0c8bf2e
Add comment explaining why we get the type descriptors
JelleZijlstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2024-07-23-17-13-10.gh-issue-119180.5PZELo.rst
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix handling of classes with custom metaclasses in | ||
``annotationlib.get_annotations``. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth explaining, in a comment or docstring (here or somewhere) why we have to go to these odd lengths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, will do that. Thanks for reviewing!