10000 bpo-43224: Implement PEP 646 changes to genericaliasobject.c by mrahtz · Pull Request #31019 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-43224: Implement PEP 646 changes to genericaliasobject.c #31019

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
merged 19 commits into from
Mar 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove references to starred *tuples* specifically (since we removed …
…the restriction that only tuples can be starred
  • Loading branch information
mrahtz committed Feb 15, 2022
commit 38dca54e5a2e94237fa4691e73287b642732e9fb
9 changes: 4 additions & 5 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ typedef struct {
PyObject *parameters;
PyObject* weakreflist;
// Whether we're a starred type, e.g. *tuple[int].
// Only supported for `tuple`.
bool starred;
} gaobject;

Expand Down Expand Up @@ -648,13 +647,13 @@ ga_iternext(gaiterobject *gi) {
return NULL;
}
gaobject *alias = (gaobject *)gi->obj;
PyObject *starred_tuple = Py_GenericAlias(alias->origin, alias->args);
if (starred_tuple == NULL) {
PyObject *starred_alias = Py_GenericAlias(alias->origin, alias->args);
if (starred_alias == NULL) {
return NULL;
}
((gaobject *)starred_tuple)->starred = true;
((gaobject *)starred_alias)->starred = true;
Py_SETREF(gi->obj, NULL);
return starred_tuple;
return starred_alias;
}

static void
Expand Down
0