History

perf python: Reference Py_None before returning it

Python None objects are handled just like all the other objects with respect to their reference counting. Before returning Py_None, its reference count thus needs to be bumped.

Petr Machata committed 8 years ago

Commit 83428f21 parent 751b1781 file · +3 −1Browse files

Showing the changes to tools/perf/util/python.c (1 of 1 file). Show all

Unified · Split

tools/perf/util/python.c+3−1
@@ -1004,8 +1004,10 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, · 1003 unmodified lines
10041004 return PyErr_NoMemory();
10051005
10061006 evsel = perf_evlist__event2evsel(evlist, event);
1007− if (!evsel)
1007+ if (!evsel) {
1008+ Py_INCREF(Py_None);
10081009 return Py_None;
1010+ }
10091011
10101012 pevent->evsel = evsel;
10111013

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t