MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / PyObjectToString

Function PyObjectToString

tensorflow/python/util/util.cc:111–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111string PyObjectToString(PyObject* o) {
112 if (o == nullptr) {
113 return "<null object>";
114 }
115 PyObject* str = PyObject_Str(o);
116 if (str) {
117#if PY_MAJOR_VERSION < 3
118 string s(PyString_AS_STRING(str));
119#else
120 string s(PyUnicode_AsUTF8(str));
121#endif
122 Py_DECREF(str);
123 return tensorflow::strings::StrCat("type=", GetClassName(o), " str=", s);
124 } else {
125 return "<failed to execute str() on object>";
126 }
127}
128
129class CachedTypeCheck {
130 public:

Callers 4

SetDifferentKeysErrorFunction · 0.70
AssertSameStructureFunction · 0.70

Calls 2

GetClassNameFunction · 0.70
StrCatFunction · 0.50

Tested by

no test coverage detected