| 226 | } |
| 227 | |
| 228 | PyObject* TypePy::createInstanceByName(PyObject* args) |
| 229 | { |
| 230 | const char* name {}; |
| 231 | PyObject* load = Py_False; // NOLINT |
| 232 | if (!PyArg_ParseTuple(args, "s|O!", &name, &PyBool_Type, &load)) { |
| 233 | return nullptr; |
| 234 | } |
| 235 | |
| 236 | bool loadModule = asBoolean(load); |
| 237 | Base::Type type = Type::getTypeIfDerivedFrom(name, BaseClass::getClassTypeId(), loadModule); |
| 238 | if (type.isBad()) { |
| 239 | Py_Return; |
| 240 | } |
| 241 | |
| 242 | void* typeInstance = type.createInstance(); |
| 243 | if (!typeInstance) { |
| 244 | Py_Return; |
| 245 | } |
| 246 | |
| 247 | BaseClass* base = static_cast<BaseClass*>(typeInstance); |
| 248 | |
| 249 | return createPyObject(base); |
| 250 | } |
| 251 | |
| 252 | Py::String TypePy::getName() const |
| 253 | { |
nothing calls this directly
no test coverage detected