pitrou commented on code in PR #50409:
URL: https://github.com/apache/arrow/pull/50409#discussion_r3542034357
##########
python/pyarrow/src/arrow/python/numpy_to_arrow.cc:
##########
@@ -836,9 +836,9 @@ Status NumPyConverter::Visit(const StructType& type) {
return Status::Invalid("Missing field '", field->name(), "' in struct
array");
}
PyArray_Descr* sub_dtype =
- reinterpret_cast<PyArray_Descr*>(PyTuple_GET_ITEM(tup, 0));
+ reinterpret_cast<PyArray_Descr*>(PyTuple_GetItem(tup, 0));
Review Comment:
Need to check for errors.
##########
python/pyarrow/src/arrow/python/common.h:
##########
@@ -398,8 +399,8 @@ struct PyBytesView {
// View the given Python object as binary-like, i.e. bytes
Status ParseBinary(PyObject* obj) {
if (PyBytes_Check(obj)) {
- bytes = PyBytes_AS_STRING(obj);
- size = PyBytes_GET_SIZE(obj);
+ bytes = PyBytes_AsString(obj);
+ size = PyBytes_Size(obj);
Review Comment:
Need to check for errors here, at least as a debug assertion (since those
functions shouldn't fail on a bytes object).
##########
python/pyarrow/src/arrow/python/numpy_to_arrow.cc:
##########
@@ -690,9 +690,9 @@ Status AppendUTF32(const char* data, int64_t itemsize, int
byteorder, T* builder
return Status::Invalid("failed converting UTF32 to UTF8");
}
- const int32_t length =
static_cast<int32_t>(PyBytes_GET_SIZE(utf8_obj.obj()));
+ const int32_t length = static_cast<int32_t>(PyBytes_Size(utf8_obj.obj()));
Review Comment:
Need to check for errors.
##########
python/pyarrow/src/arrow/python/python_to_arrow.cc:
##########
@@ -1050,8 +1049,8 @@ class PyStructConverter : public
StructConverter<PyConverter, PyConverterTrait>
PyObject* unicode =
PyUnicode_FromStringAndSize(field_name.c_str(), field_name.size());
RETURN_IF_PYERROR();
- PyList_SET_ITEM(bytes_field_names_.obj(), i, bytes);
- PyList_SET_ITEM(unicode_field_names_.obj(), i, unicode);
+ PyList_SetItem(bytes_field_names_.obj(), i, bytes);
+ PyList_SetItem(unicode_field_names_.obj(), i, unicode);
Review Comment:
Need to assert for errors.
##########
python/pyarrow/src/arrow/python/common.h:
##########
Review Comment:
Why not replace these as well? Or are they part of the Limited API?
##########
python/pyarrow/src/arrow/python/benchmark.cc:
##########
Review Comment:
We should probably remove this file instead. Nobody ever runs.
--
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]