Repository navigation
bpo-43224: Draft implementation of PEP 646 #30398
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
64abc0a
PEP 646: Grammar and compiler changes
mrahtz b725671
PEP 646: Add tests for syntax changes
mrahtz ea329b9
PEP 646: Add AST tests for *args annotations
mrahtz 681dc4e
PEP 646: Add AST tests for return types with unpacking
mrahtz 69f575f
PEP 646: Add AST tests for variable annotations with unpacking
mrahtz 095a620
PEP 646: Add support for starring tuple types
mrahtz 6713748
PEP 646: Add tests for starring tuple types
mrahtz 038b8f0
PEP 646: Implement support in typing.py
mrahtz f028339
PEP 646: Add tests for everything in typing.py
mrahtz 38c17d3
PEP 646: Add tests for typing.get_{origin,args}
mrahtz 9991937
PEP 646: Various fixes to genericaliasobject.c
mrahtz 9017d22
PEP 646: Fix test_pep646_syntax import
mrahtz 07ed599
PEP 646: Add docstring for TypeVarTuple
mrahtz 74e5252
PEP 646: Swap a Py_INCREF with a Py_NewRef
mrahtz 6cb3aa5
PEP 646: Add test for assigning to a slice containing a star
mrahtz daef59b
📜🤖 Added by blurb_it.
blurb-it[bot] 3c2a7e7
PEP 646: Add line to Doc/whatsnew
mrahtz 456156a
PEP 646: Use stdbool.h; separate test cases
mrahtz 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
PEP 646: Various fixes to genericaliasobject.c
Based on Fidget-Spinner's feedback: 1. Remove the explicit flag for 'exhausted', instead using 'gi->obj == NULL' to tell whether the iterator is exhausted. 2. Construct `starred_tuple` using the `Py_GenericAlias` constructor instead of constructing it manually. 3. Fix reference counting. 4. Make `Py_GenericAliasIterType` static.
- Loading branch information
commit 9991937e5472a9d98868d1426bff09578a4b0c0f
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
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.
I feel like you could potentially be missing a decref here for
gi->objsince I see it being increfed ingi_iter. If so,If I'm just shooting my mouth off, then just please ignore what I said :).
One way to test for refleaks is to run the tests with the refleak hunter (requires a debug build):
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.
Oh, super nice about the refleak hunter - I had no idea that was a thing!
And good catch about the decref too. One thing I'm unsure about is where we should do it, though. Reading https://docs.python.org/3/c-api/gcsupport.html, am I right in thinking that the iterator object
gicounts as a container type, because it contains references to another object? If so, that same page says "Before fields which refer to other containers are invalidated, PyObject_GC_UnTrack() must be called". That would imply we should be settinggi->objto NULL in the deallocator, in which case we'd also call the setref there?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.
Friendly poke :)