You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/07/17 19:01:53 UTC

[arrow] branch master updated: ARROW-3032: [C++] Clean up Numpy-related headers

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 906eda2  ARROW-3032: [C++] Clean up Numpy-related headers
906eda2 is described below

commit 906eda2ac5bada52c2b42ef48ceca772b2dc3549
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Wed Jul 17 13:59:36 2019 -0500

    ARROW-3032: [C++] Clean up Numpy-related headers
    
    Remove some unused functions
    
    Closes #4899 from pitrou/ARROW-3032-numpy-headers and squashes the following commits:
    
    e094f3b2d <Antoine Pitrou> ARROW-3032:  Clean up Numpy-related headers
    
    Authored-by: Antoine Pitrou <an...@python.org>
    Signed-off-by: Wes McKinney <we...@apache.org>
---
 cpp/src/arrow/python/numpy_convert.cc | 13 ++++---------
 cpp/src/arrow/python/numpy_convert.h  | 10 ----------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/cpp/src/arrow/python/numpy_convert.cc b/cpp/src/arrow/python/numpy_convert.cc
index 515864a..30e6198 100644
--- a/cpp/src/arrow/python/numpy_convert.cc
+++ b/cpp/src/arrow/python/numpy_convert.cc
@@ -37,15 +37,6 @@
 namespace arrow {
 namespace py {
 
-bool is_contiguous(PyObject* array) {
-  if (PyArray_Check(array)) {
-    return (PyArray_FLAGS(reinterpret_cast<PyArrayObject*>(array)) &
-            (NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS)) != 0;
-  } else {
-    return false;
-  }
-}
-
 NumPyBuffer::NumPyBuffer(PyObject* ao) : Buffer(nullptr, 0) {
   PyAcquireGIL lock;
   arr_ = ao;
@@ -73,6 +64,8 @@ NumPyBuffer::~NumPyBuffer() {
     *out = FACTORY();                         \
     break;
 
+namespace {
+
 Status GetTensorType(PyObject* dtype, std::shared_ptr<DataType>* out) {
   if (!PyArray_DescrCheck(dtype)) {
     return Status::TypeError("Did not pass numpy.dtype object");
@@ -127,6 +120,8 @@ Status GetNumPyType(const DataType& type, int* type_num) {
   return Status::OK();
 }
 
+}  // namespace
+
 Status NumPyDtypeToArrow(PyObject* dtype, std::shared_ptr<DataType>* out) {
   if (!PyArray_DescrCheck(dtype)) {
     return Status::TypeError("Did not pass numpy.dtype object");
diff --git a/cpp/src/arrow/python/numpy_convert.h b/cpp/src/arrow/python/numpy_convert.h
index 5fa1326..85ef36b 100644
--- a/cpp/src/arrow/python/numpy_convert.h
+++ b/cpp/src/arrow/python/numpy_convert.h
@@ -49,21 +49,11 @@ class ARROW_PYTHON_EXPORT NumPyBuffer : public Buffer {
   PyObject* arr_;
 };
 
-// Handle misbehaved types like LONGLONG and ULONGLONG
-ARROW_PYTHON_EXPORT
-int cast_npy_type_compat(int type_num);
-
-ARROW_PYTHON_EXPORT
-bool is_contiguous(PyObject* array);
-
 ARROW_PYTHON_EXPORT
 Status NumPyDtypeToArrow(PyObject* dtype, std::shared_ptr<DataType>* out);
 ARROW_PYTHON_EXPORT
 Status NumPyDtypeToArrow(PyArray_Descr* descr, std::shared_ptr<DataType>* out);
 
-Status GetTensorType(PyObject* dtype, std::shared_ptr<DataType>* out);
-Status GetNumPyType(const DataType& type, int* type_num);
-
 ARROW_PYTHON_EXPORT Status NdarrayToTensor(MemoryPool* pool, PyObject* ao,
                                            const std::vector<std::string>& dim_names,
                                            std::shared_ptr<Tensor>* out);