python: Fix PyEvent reference counting bug
authorAndreas Sandberg <andreas.sandberg@arm.com>
Wed, 10 May 2017 09:57:27 +0000 (10:57 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Wed, 24 May 2017 14:28:45 +0000 (14:28 +0000)
commit642818f1f39dd73e478f136d0306989f33d3ad8f
tree4ef01f1e5a2591458ce4967745a591f6a4382da9
parent5b3752c37280b0ae508bda824c89810136bf9360
python: Fix PyEvent reference counting bug

The current implementation of reference counting for PyEvents only
partially works. The native object is currently kept alive while it is
in the event queue. However, if the Python object goes out of scope,
the Python side of this object is garbage collected which leaves a
"dangling" native object. This results in confusing error messages
where PyBind is unable to find the Python implementation of an event
when it is triggered.

Implement reference counting using the generalized reference counting
API instead.

Change-Id: I4e8e04abc4f61dff238d718065f5371e73b38ab3
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/3222
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/python/m5/event.py
src/python/pybind11/event.cc