| 148 | // Declaration of 'construct<T>()' for protobufs. |
| 149 | template <typename T> |
| 150 | typename std::enable_if< |
| 151 | std::is_base_of<google::protobuf::Message, T>::value, |
| 152 | std::unique_ptr<T>>::type |
| 153 | construct(PyObject* obj) |
| 154 | { |
| 155 | std::unique_ptr<T> result(new T()); |
| 156 | if (!readPythonProtobuf(obj, result.get())) { |
| 157 | PyErr_Format( |
| 158 | PyExc_TypeError, |
| 159 | "Failed to construct %s from a Python object", |
| 160 | result->GetDescriptor()->full_name().c_str()); |
| 161 | |
| 162 | return nullptr; |
| 163 | } |
| 164 | |
| 165 | return result; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | // Declaration of 'construct<T>()' for non-protobufs. |
nothing calls this directly
no test coverage detected