| 913 | } |
| 914 | |
| 915 | py::UniqueObj DocumentObject::getattro(PyObject* attr) const |
| 916 | { |
| 917 | if (!corpus->isIndependent()) return py::UniqueObj{ PyObject_GenericGetAttr((PyObject*)this, attr) }; |
| 918 | std::string a; |
| 919 | if (!py::toCpp<std::string>(attr, a)) throw py::AttributeError{ "invalid attribute name" }; |
| 920 | string name = a; |
| 921 | auto it = getRawDoc()->misc.find(name); |
| 922 | if (it == getRawDoc()->misc.end()) return py::UniqueObj{ PyObject_GenericGetAttr((PyObject*)this, attr) }; |
| 923 | auto ret = py::UniqueObj{ (PyObject*)std::get<std::shared_ptr<void>>(it->second).get() }; |
| 924 | Py_INCREF(ret.get()); |
| 925 | return ret; |
| 926 | } |
| 927 | |
| 928 | std::string DocumentObject::repr() const |
| 929 | { |
nothing calls this directly
no test coverage detected