Skip to content
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
Address review
  • Loading branch information
sergey-miryanov committed Mar 7, 2026
commit 9d286670311b104cd40c7af13bd7f219582f7d69
34 changes: 12 additions & 22 deletions Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,44 +219,34 @@
}

PyObject *
_PyTuple_FromPair(PyObject *one, PyObject *two)
_PyTuple_FromPair(PyObject *first, PyObject *second)
{
assert(one != NULL);
assert(two != NULL);
assert(first != NULL);
assert(second != NULL);

PyTupleObject *op = tuple_alloc_2();
if (op == NULL) {
return NULL;
}
PyObject **items = op->ob_item;
items[0] = Py_NewRef(one);
items[1] = Py_NewRef(two);
if (maybe_tracked(items[0]) || maybe_tracked(items[1])) {
_PyObject_GC_TRACK(op);
}
return (PyObject *)op;
return _PyTuple_FromPairSteal(Py_NewRef(first), Py_NewRef(second));
}

PyObject *
_PyTuple_FromPairSteal(PyObject *one, PyObject *two)
_PyTuple_FromPairSteal(PyObject *first, PyObject *second)
{
assert(one != NULL);
assert(two != NULL);
assert(first != NULL);
assert(second != NULL);

PyTupleObject *op = tuple_alloc_2();
if (op == NULL) {
Py_DECREF(one);
Py_DECREF(two);
Py_DECREF(first);
Py_DECREF(second);
return NULL;
}
PyObject **items = op->ob_item;
items[0] = one;
items[1] = two;
if (maybe_tracked(one || maybe_tracked(two)) {
items[0] = first;
items[1] = second;
if (maybe_tracked(first || maybe_tracked(second)) {

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

syntax error: missing ')' before '{' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'maybe_tracked': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

syntax error: missing ')' before '{' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'maybe_tracked': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

syntax error: missing ')' before '{' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'maybe_tracked': different types for formal and actual parameter 1 [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': 'PyObject *' differs in levels of indirection from 'int' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

syntax error: missing ')' before '{' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'maybe_tracked': different types for formal and actual parameter 1 [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': 'PyObject *' differs in levels of indirection from 'int' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]

Check failure on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘)’ before ‘{’ token

Check warning on line 245 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 1 of ‘maybe_tracked’ makes pointer from integer without a cast [-Wint-conversion]
_PyObject_GC_TRACK(op);
}
return (PyObject *)op;
}

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected expression before ‘}’ token

Check warning on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

control reaches end of non-void function [-Wreturn-type]

Check failure on line 249 in Objects/tupleobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected expression before ‘}’ token

/* Methods */

Expand Down
Loading