Skip to content

Commit 4ed5ad7

Browse files
authored
bpo-30961: Fix decrementing a borrowed reference in tracemalloc. (#2747)
1 parent ba75af7 commit 4ed5ad7

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
@@ -1752,7 +1752,7 @@ _PyTraceMalloc_Init(void)
17521752
if (key == NULL)
17531753
return -1;
17541754

1755-
value = PyDict_GetItemWithError(xoptions, key);
1755+
value = PyDict_GetItemWithError(xoptions, key); /* borrowed */
17561756
Py_DECREF(key);
17571757
if (value == NULL) {
17581758
if (PyErr_Occurred())
@@ -1763,7 +1763,6 @@ _PyTraceMalloc_Init(void)
17631763
}
17641764

17651765
nframe = parse_sys_xoptions(value);
1766-
Py_DECREF(value);
17671766
if (nframe < 0) {
17681767
Py_FatalError("-X tracemalloc=NFRAME: invalid number of frames");
17691768
}

0 commit comments

Comments
 (0)