Skip to content

Commit cb3f024

Browse files
authored
bpo-30961: Fix decrementing a borrowed reference in tracemalloc. (#2747) (#2749)
(cherry picked from commit 4ed5ad7)
1 parent 45c471c commit cb3f024

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix decrementing a borrowed reference in tracemalloc.

Modules/_tracemalloc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ _PyTraceMalloc_Init(void)
14081408
if (key == NULL)
14091409
return -1;
14101410

1411-
value = PyDict_GetItemWithError(xoptions, key);
1411+
value = PyDict_GetItemWithError(xoptions, key); /* borrowed */
14121412
Py_DECREF(key);
14131413
if (value == NULL) {
14141414
if (PyErr_Occurred())
@@ -1419,7 +1419,6 @@ _PyTraceMalloc_Init(void)
14191419
}
14201420

14211421
nframe = parse_sys_xoptions(value);
1422-
Py_DECREF(value);
14231422
if (nframe < 0) {
14241423
Py_FatalError("-X tracemalloc=NFRAME: invalid number of frames");
14251424
}

0 commit comments

Comments
 (0)