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

Method ParseString

python/pyarrow/src/arrow/python/common.h:370–387  ·  view source on GitHub ↗

View the given Python object as string-like, i.e. str or (utf8) bytes

Source from the content-addressed store, hash-verified

368
369 // View the given Python object as string-like, i.e. str or (utf8) bytes
370 Status ParseString(PyObject* obj, bool check_utf8 = false) {
371 if (PyUnicode_Check(obj)) {
372 return ParseUnicode(obj);
373 } else {
374 ARROW_RETURN_NOT_OK(ParseBinary(obj));
375 if (check_utf8) {
376 // Check the bytes are utf8 utf-8
377 OwnedRef decoded(PyUnicode_FromStringAndSize(bytes, size));
378 if (ARROW_PREDICT_TRUE(!PyErr_Occurred())) {
379 is_utf8 = true;
380 } else {
381 PyErr_Clear();
382 is_utf8 = false;
383 }
384 }
385 return Status::OK();
386 }
387 }
388
389 // View the given Python object as unicode string
390 Status ParseUnicode(PyObject* obj) {

Callers 2

FromStringMethod · 0.95
ConvertMethod · 0.80

Calls 1

OKFunction · 0.50

Tested by

no test coverage detected