MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / PyStringAsString

Function PyStringAsString

oneflow/api/python/functional/common.cpp:116–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116std::string PyStringAsString(PyObject* obj) {
117 PyObject* bytes = PyUnicode_AsEncodedString(obj, "utf-8", "~E~");
118 std::string str = PyBytes_AS_STRING(bytes);
119 Py_XDECREF(bytes);
120 return str;
121}
122
123std::string PyObjectToReprStr(PyObject* obj) {
124 PyObject* repr_obj = PyObject_Repr(obj);

Callers 15

PyTensorObject_castFunction · 0.85
PyTensorObject_varFunction · 0.85
PyTensorObject_stdFunction · 0.85
PyTensorObject_setitemFunction · 0.85
PyIInfo_newFunction · 0.85
PyFInfo_newFunction · 0.85
UnpackTensorTupleFunction · 0.85
PyObjectToReprStrFunction · 0.85
string>Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected