-
Notifications
You must be signed in to change notification settings - Fork 1
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
Base implementation of PEP 696 #2
base: pep696
Are you sure you want to change the base?
Conversation
Objects/genericaliasobject.c
Outdated
bool does_not_contain = tuple_index(parameters, nargs, t) == -1; | ||
if (does_not_contain) { | ||
if (_PyObject_LookupAttr(t, &_Py_ID(__default__), &default_) < 0) { | ||
Py_DECREF(default_); |
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.
Isn't default_ uninitialized here? I think we need to DECREF it in the next branch instead.
Objects/genericaliasobject.c
Outdated
bool does_not_contain = tuple_index(parameters, nargs, t2) == -1; | ||
if (does_not_contain) { | ||
if (_PyObject_LookupAttr(t2, &_Py_ID(__default__), &default_) < 0) { | ||
Py_DECREF(default_); |
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.
Similar issues here
T = typing.TypeVar("T") | ||
U = typing.TypeVar("U", default=int) | ||
|
||
self.assertEqual((list[U] | list[T]).__parameters__, (U, T)) |
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.
Won't this raise TypeError as the next test asserts?
Co-authored-by: Marc Mueller [email protected]