comparison PyExtensionManager.cpp @ 89:f92587bedb2c

Further small tidying
author Chris Cannam
date Thu, 10 Jan 2019 15:52:21 +0000
parents 146d14ab15e7
children c4510e5f7a17
comparison
equal deleted inserted replaced
88:0120dac53a69 89:f92587bedb2c
133 } 133 }
134 134
135 void 135 void
136 PyExtensionManager::cleanLocalNamespace(const char* plugModuleName) const 136 PyExtensionManager::cleanLocalNamespace(const char* plugModuleName) const
137 { 137 {
138
139 /// these references are all borrowed 138 /// these references are all borrowed
140 PyObject *pyPlugModule = PyDict_GetItemString(m_pyGlobalNamespace,plugModuleName); 139 PyObject *pyPlugModule = PyDict_GetItemString(m_pyGlobalNamespace,plugModuleName);
141 if (!pyPlugModule) return; 140 if (!pyPlugModule) return;
142 PyObject *pyPlugDict = PyModule_GetDict(pyPlugModule); 141 PyObject *pyPlugDict = PyModule_GetDict(pyPlugModule);
143 if (!pyPlugDict) return; 142 if (!pyPlugDict) return;
181 PyObject* item = PyDict_GetItem(m_pyVampyNamespace,key); 180 PyObject* item = PyDict_GetItem(m_pyVampyNamespace,key);
182 if (PyDict_SetItem(pyPlugDict,key,item) != 0) 181 if (PyDict_SetItem(pyPlugDict,key,item) != 0)
183 cerr << "Vampy::PyExtensionManager::updateLocalNamespace: Failed: " 182 cerr << "Vampy::PyExtensionManager::updateLocalNamespace: Failed: "
184 << name << " of "<< plugModuleName << endl; 183 << name << " of "<< plugModuleName << endl;
185 else DSTREAM << "Updated local name: " << name << endl; 184 else DSTREAM << "Updated local name: " << name << endl;
185 } else {
186 DSTREAM << "Local namespace does not contain name: " << name << endl;
186 } 187 }
187 Py_DECREF(key); 188 Py_DECREF(key);
188 } 189 }
189 } 190 }
190 191
191 192
192 bool 193 bool
193 PyExtensionManager::cleanModule(void) const 194 PyExtensionManager::cleanModule(void) const
194 { 195 {
195
196 PyObject *m = PyImport_AddModule("vampy"); 196 PyObject *m = PyImport_AddModule("vampy");
197 if (!m) { 197 if (!m) {
198 if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} 198 if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();}
199 cerr << "Vampy::PyExtensionManager::cleanModule: PyImport_AddModule returned NULL!" << endl; 199 cerr << "Vampy::PyExtensionManager::cleanModule: PyImport_AddModule returned NULL!" << endl;
200 return false; 200 return false;