| 162 | } |
| 163 | |
| 164 | int py_set_scope(PyObject* obj, PyObject* value, void* /* closure */) { |
| 165 | if (value == NULL) { |
| 166 | PyErr_SetString(PyExc_TypeError, "Cannot delete the attribute"); |
| 167 | return -1; |
| 168 | } |
| 169 | try { |
| 170 | reinterpret_cast<PyOp(OpDef)*>(obj)->op->set_scope( |
| 171 | py::cast<std::string>(py::handle(value))); |
| 172 | } |
| 173 | CATCH_ALL(-1) |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | PyGetSetDef PyOp(OpDef)::py_getsetters[] = { |
| 178 | {const_cast<char*>("scope"), py_get_scope, py_set_scope, |