We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48d0d0d commit fbb7342Copy full SHA for fbb7342
Objects/tupleobject.c
@@ -175,12 +175,18 @@ PyTuple_Pack(Py_ssize_t n, ...)
175
return NULL;
176
}
177
items = result->ob_item;
178
+ bool track = false;
179
for (i = 0; i < n; i++) {
180
o = va_arg(vargs, PyObject *);
181
items[i] = Py_NewRef(o);
182
+ if (!track && _PyObject_GC_MAY_BE_TRACKED(items[i])) {
183
+ track = true;
184
+ }
185
186
va_end(vargs);
- _PyObject_GC_TRACK(result);
187
+ if (track) {
188
+ _PyObject_GC_TRACK(result);
189
190
return (PyObject *)result;
191
192
0 commit comments