From 211a131351cccbcce6f5412180da64f650a8b1a4 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Mon, 2 Mar 2015 04:04:14 +0000 Subject: [PATCH] Fix Python3 binding's submodules Previously the Python3 cv2 package ends up with no submodules (bgsegm, face, etc) in it, which makes a lot of functionality unusable. By not writing over our root reference we ensure the new submodules are added to the correct cv2 module. --- modules/python/src2/cv2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 59a4c67bc..ff53d733c 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -1235,7 +1235,9 @@ static void init_submodule(PyObject * root, const char * name, PyMethodDef * met submod = PyImport_AddModule(full_name.c_str()); PyDict_SetItemString(d, short_name.c_str(), submod); } - root = submod; + + if (short_name != "") + root = submod; } // populate module's dict