| 959 | } |
| 960 | |
| 961 | PyObject* SameNamedtuples(PyObject* o1, PyObject* o2) { |
| 962 | Safe_PyObjectPtr f1 = make_safe(PyObject_GetAttrString(o1, "_fields")); |
| 963 | Safe_PyObjectPtr f2 = make_safe(PyObject_GetAttrString(o2, "_fields")); |
| 964 | if (f1 == nullptr || f2 == nullptr) { |
| 965 | PyErr_SetString( |
| 966 | PyExc_RuntimeError, |
| 967 | "Expected namedtuple-like objects (that have _fields attr)"); |
| 968 | return nullptr; |
| 969 | } |
| 970 | |
| 971 | if (PyObject_RichCompareBool(f1.get(), f2.get(), Py_NE)) { |
| 972 | Py_RETURN_FALSE; |
| 973 | } |
| 974 | |
| 975 | if (GetClassName(o1).compare(GetClassName(o2)) == 0) { |
| 976 | Py_RETURN_TRUE; |
| 977 | } else { |
| 978 | Py_RETURN_FALSE; |
| 979 | } |
| 980 | } |
| 981 | |
| 982 | PyObject* AssertSameStructure(PyObject* o1, PyObject* o2, bool check_types, |
| 983 | bool expand_composites) { |
no test coverage detected