pitrou commented on code in PR #50409:
URL: https://github.com/apache/arrow/pull/50409#discussion_r3658588461
##########
python/pyarrow/src/arrow/python/common.h:
##########
@@ -425,10 +429,13 @@ struct PyBytesView {
RETURN_IF_PYERROR();
if (!PyBytes_Check(ref.obj())) {
return Status::TypeError("Expected uuid.UUID.bytes to return bytes, got
'",
- Py_TYPE(ref.obj())->tp_name, "' object");
+ internal::PyObject_StdStringTypeName(ref.obj()),
+ "' object");
}
- bytes = PyBytes_AS_STRING(ref.obj());
- size = PyBytes_GET_SIZE(ref.obj());
+ bytes = PyBytes_AsString(ref.obj());
+ RETURN_IF_PYERROR();
+ size = PyBytes_Size(ref.obj());
+ RETURN_IF_PYERROR();
Review Comment:
Similarly as above, this can be reduced to a single `ARROW_DCHECK` as these
calls shouldn't normally fail after `PyBytes_Check` returned true.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]