diff options
author | Iwase Yusuke <iwase.yusuke0@gmail.com> | 2016-08-23 14:07:25 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-25 14:25:40 +0900 |
commit | db0f6c1165ca8941d75a4d2e5f8014933485da7d (patch) | |
tree | 65d559387694462ac1ac527b2d54eb579aeda623 | |
parent | 37df91f7f46407fe0b1f12d56f6c3b71d69156cd (diff) |
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 <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/controller/handler.py | 5 |
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 |