Skip to content

Commit 557a709

Browse files
authored
Use Py_DECREF after PyObject_CallObject call (#6781)
`PyObject_CallObject` returns new reference: https://docs.python.org/3/c-api/call.html#c.PyObject_CallObject. Signed-off-by: Anatoly Myachev <[email protected]>
1 parent d90b234 commit 557a709

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

third_party/amd/backend/driver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def format_of(ty):
441441
Py_DECREF(args);
442442
if (!ret)
443443
return NULL;
444+
Py_DECREF(ret);
444445
}}
445446
446447
@@ -454,6 +455,7 @@ def format_of(ty):
454455
Py_DECREF(args);
455456
if (!ret)
456457
return NULL;
458+
Py_DECREF(ret);
457459
}}
458460
459461
if(PyErr_Occurred()) {{

third_party/nvidia/backend/driver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ def format_of(ty):
472472
Py_DECREF(args);
473473
if (!ret)
474474
return NULL;
475+
Py_DECREF(ret);
475476
}}
476477
477478
CUdeviceptr global_scratch = 0;
@@ -499,7 +500,7 @@ def format_of(ty):
499500
Py_DECREF(args);
500501
if (!ret)
501502
return NULL;
502-
503+
Py_DECREF(ret);
503504
}}
504505
505506
Py_RETURN_NONE;

0 commit comments

Comments
 (0)