python modules in the game engine could point to builtin modules like GameLogic that was cleared.
I added module clearing before there was checks for invalid python objects, so now its not needed for BGE Builtin types at least. also made the builtin modules get re-used if they already exist and clear all user modules when the game engine finishes so with Module-Py-Controllers the referenced modules are at least up to date when pressing Pkey.
This commit is contained in:
@@ -676,11 +676,23 @@ static struct PyModuleDef Expression_module_def = {
|
||||
extern "C" {
|
||||
void initExpressionModule(void)
|
||||
{
|
||||
PyObject *m;
|
||||
/* Use existing module where possible
|
||||
* be careful not to init any runtime vars after this */
|
||||
m = PyImport_ImportModule( "Expression" );
|
||||
if(m) {
|
||||
Py_DECREF(m);
|
||||
return m;
|
||||
}
|
||||
else {
|
||||
PyErr_Clear();
|
||||
|
||||
#if (PY_VERSION_HEX >= 0x03000000)
|
||||
PyModule_Create(&Expression_module_def);
|
||||
PyModule_Create(&Expression_module_def);
|
||||
#else
|
||||
Py_InitModule("Expression",CParserMethods);
|
||||
Py_InitModule("Expression",CParserMethods);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user