MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / initWrapTester

Function initWrapTester

src/python/PyImathTest/main.cpp:173–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171};
172
173void
174initWrapTester ()
175{
176#if PY_MAJOR_VERSION >= 3
177 static struct PyModuleDef moduleDef =
178 {
179 PyModuleDef_HEAD_INIT,
180 "wrap",
181 "wrap module",
182 -1,
183 methods
184 };
185
186 PyObject* module = PyModule_Create(&moduleDef);
187 assert (module != 0);
188 // I (jyost) don't know if there's a better way to do the following,
189 // but this works. (I did look at the docs and try various things to
190 // see if I could find a better way, and this is what I landed on.)
191 auto sysModule = PyImport_AddModule("sys");
192 auto sysModuleDict = PyModule_GetDict(sysModule);
193 auto modulesDict = PyDict_GetItemString(sysModuleDict, "modules");
194 PyDict_SetItemString(modulesDict, moduleDef.m_name, module);
195#else
196 PyObject *module = Py_InitModule ("wrap", methods);
197 assert (module != 0);
198#endif
199}
200
201
202void

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected