arw2019 commented on a change in pull request #8044:
URL: https://github.com/apache/arrow/pull/8044#discussion_r479811805
##########
File path: cpp/src/arrow/python/python_to_arrow.cc
##########
@@ -106,7 +106,12 @@ struct ValueConverter<Type, enable_if_integer<Type>> {
static inline Result<ValueType> FromPython(PyObject* obj) {
ValueType value;
- RETURN_NOT_OK(internal::CIntFromPython(obj, &value));
+ arrow::Status s_ = internal::CIntFromPython(obj, &value);
+ if (!s_.ok() && !internal::PyIntScalar_Check(obj)) {
+ return internal::InvalidValue(obj, "tried to convert to int");
+ } else {
+ RETURN_NOT_OK(s_);
Review comment:
Yes, and also when converting a negative integer to a `uint`:
```
pa.scalar(-1, type='uint8')
```
No other tests are touched if I recompile without this check
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]