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

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
1004 return PyErr_NoMemory();1004 return PyErr_NoMemory();
1005 1005
1006 evsel = perf_evlist__event2evsel(evlist, event);1006 evsel = perf_evlist__event2evsel(evlist, event);
1007 if (!evsel)1007 if (!evsel) {
1008 Py_INCREF(Py_None);
1008 return Py_None;1009 return Py_None;
1010 }
1009 1011
1010 pevent->evsel = evsel;1012 pevent->evsel = evsel;
1011 1013

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