| 451 | class AttrsValueIterator : public ValueIterator { |
| 452 | public: |
| 453 | explicit AttrsValueIterator(PyObject* nested) : nested_(nested) { |
| 454 | Py_INCREF(nested); |
| 455 | cls_.reset(PyObject_GetAttrString(nested_.get(), "__class__")); |
| 456 | if (cls_) { |
| 457 | attrs_.reset(PyObject_GetAttrString(cls_.get(), "__attrs_attrs__")); |
| 458 | if (attrs_) { |
| 459 | iter_.reset(PyObject_GetIter(attrs_.get())); |
| 460 | } |
| 461 | } |
| 462 | if (!iter_ || PyErr_Occurred()) invalidate(); |
| 463 | } |
| 464 | |
| 465 | Safe_PyObjectPtr next() override { |
| 466 | Safe_PyObjectPtr result; |