Skip to content

Conversation

Gobot1234
Copy link

Co-authored-by: Marc Mueller [email protected]

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_);
Copy link
Owner

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.

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_);
Copy link
Owner

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))
Copy link
Owner

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?

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.

2 participants