Skip to content

Commit

Permalink
WIP Don't overwrite _COb in PInit
Browse files Browse the repository at this point in the history
  • Loading branch information
speleo3 committed Feb 29, 2024
1 parent 68ce6b5 commit 3004d20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions layer1/P.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,8 +1914,12 @@ void PInit(PyMOLGlobals * G, int global_instance)
if(global_instance) {
assert(SingletonPyMOLGlobals);
/* implies global singleton pymol, so set up the global handle */
PyObject_SetAttrString(P_cmd, "_COb",
PyCapsule_New(&SingletonPyMOLGlobals, nullptr, nullptr));

auto cob = PyObject_GetAttrString(P_cmd, "_COb");
if (!cob || cob == Py_None) {
PyObject_SetAttrString(P_cmd, "_COb",
PyCapsule_New(&SingletonPyMOLGlobals, nullptr, nullptr));
}

/* cmd module is itself the api for the global PyMOL instance */
G->P_inst->cmd = P_cmd;
Expand Down

0 comments on commit 3004d20

Please sign in to comment.