summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-05-10 10:57:27 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-05-24 14:28:45 +0000
commit642818f1f39dd73e478f136d0306989f33d3ad8f (patch)
tree4ef01f1e5a2591458ce4967745a591f6a4382da9 /src/python/m5
parent5b3752c37280b0ae508bda824c89810136bf9360 (diff)
downloadgem5-642818f1f39dd73e478f136d0306989f33d3ad8f.tar.xz
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>
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/event.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/python/m5/event.py b/src/python/m5/event.py
index 20f81b93b..59d18b6fe 100644
--- a/src/python/m5/event.py
+++ b/src/python/m5/event.py
@@ -44,7 +44,8 @@ import m5
import _m5.event
from _m5.event import GlobalSimLoopExitEvent as SimExit
-from _m5.event import Event, getEventQueue, setEventQueue
+from _m5.event import PyEvent as Event
+from _m5.event import getEventQueue, setEventQueue
mainq = None