summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/controller/handler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ryu/controller/handler.py b/ryu/controller/handler.py
index f1fb7076..cda27bcc 100644
--- a/ryu/controller/handler.py
+++ b/ryu/controller/handler.py
@@ -148,6 +148,7 @@ def register_service(service):
This mechanism is used to e.g. automatically start ofp_handler if
there are applications consuming OFP events.
"""
- frm = inspect.stack()[1]
- m = inspect.getmodule(frm[0])
+ frame = inspect.currentframe()
+ m_name = frame.f_back.f_globals['__name__']
+ m = sys.modules[m_name]
m._SERVICE_NAME = service