Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-12495

[C++][Python] NumPy buffer sets is_mutable_ to true but does not set mutable_data_ when the NumPy array is writable

    XMLWordPrintableJSON

Details

    Description

      Bug is evident

      NumPyBuffer::NumPyBuffer(PyObject* ao) : Buffer(nullptr, 0) {
        PyAcquireGIL lock;
        arr_ = ao;
        Py_INCREF(ao);
      
        if (PyArray_Check(ao)) {
          PyArrayObject* ndarray = reinterpret_cast<PyArrayObject*>(ao);
          data_ = reinterpret_cast<const uint8_t*>(PyArray_DATA(ndarray));
          size_ = PyArray_SIZE(ndarray) * PyArray_DESCR(ndarray)->elsize;
          capacity_ = size_;
      
          if (PyArray_FLAGS(ndarray) & NPY_ARRAY_WRITEABLE) {
            is_mutable_ = true;
          }
        }
      }
      

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              wesm Wes McKinney
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m