From db0f6c1165ca8941d75a4d2e5f8014933485da7d Mon Sep 17 00:00:00 2001 From: Iwase Yusuke Date: Tue, 23 Aug 2016 14:07:25 +0900 Subject: [PATCH] handler: Fix for frozen builds Navigates back the stack to locate the module instead of relying on inspect to locate the module based on the file name. This patch is suggested by papostolescu as Pull Request(*1) on GitHub. (*1) https://github.com/osrg/ryu/pull/26 Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/controller/handler.py | 5 +++-- 1 file 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