PyObject *ObjectRow_PyObject__str(ObjectRow_PyObject *self) { PyObject *dict, *items, *str; items = ObjectRow_PyObject__items(self, NULL, NULL); dict = PyDict_New(); PyDict_MergeFromSeq2(dict, items, 1); str = PyObject_Str(dict); Py_DECREF(items); Py_DECREF(dict); return str; }
// Convert to dictionary, helper for builtin dict mainly. NUITKA_MAY_BE_UNUSED static PyObject *TO_DICT( PyObject *seq_obj, PyObject *dict_obj ) { PyObject *result = PyDict_New(); if ( seq_obj != NULL ) { int res; if ( PyObject_HasAttrString( seq_obj, "keys" ) ) { res = PyDict_Merge( result, seq_obj, 1 ); } else { res = PyDict_MergeFromSeq2( result, seq_obj, 1 ); } if ( res == -1 ) { return NULL; } } if ( dict_obj != NULL ) { int res = PyDict_Merge( result, dict_obj, 1 ); if ( res == -1 ) { return NULL; } } return result; }