MCPcopy Create free account
hub / github.com/apache/arrow / PyObject_StdStringRepr

Function PyObject_StdStringRepr

python/pyarrow/src/arrow/python/helpers.cc:114–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114std::string PyObject_StdStringRepr(PyObject* obj) {
115 OwnedRef unicode_ref(PyObject_Repr(obj));
116 OwnedRef bytes_ref;
117
118 if (unicode_ref) {
119 bytes_ref.reset(
120 PyUnicode_AsEncodedString(unicode_ref.obj(), "utf8", "backslashreplace"));
121 }
122 if (!bytes_ref) {
123 PyErr_Clear();
124 std::stringstream ss;
125 ss << "<object of type '" << Py_TYPE(obj)->tp_name << "' repr() failed>";
126 return ss.str();
127 }
128 return PyBytes_AsStdString(bytes_ref.obj());
129}
130
131Status PyObject_StdStringStr(PyObject* obj, std::string* out) {
132 OwnedRef string_ref(PyObject_Str(obj));

Callers 7

PyObjectToPyIntFunction · 0.85
InvalidValueFunction · 0.85
InvalidTypeFunction · 0.85
DebugPrintFunction · 0.85
SerializeExtInstanceFunction · 0.85
SetInstanceMethod · 0.85
FieldMethod · 0.85

Calls 3

PyBytes_AsStdStringFunction · 0.85
strMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected