[ 
https://issues.apache.org/jira/browse/ARROW-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364349#comment-16364349
 ] 

ASF GitHub Bot commented on ARROW-2155:
---------------------------------------

pitrou commented on a change in pull request #1607: ARROW-2155: [Python] 
frombuffer() should respect mutability of argument
URL: https://github.com/apache/arrow/pull/1607#discussion_r168226882
 
 

 ##########
 File path: python/pyarrow/io.pxi
 ##########
 @@ -802,12 +802,12 @@ def frombuffer(object obj):
     Construct an Arrow buffer from a Python bytes object
     """
     cdef shared_ptr[CBuffer] buf
-    try:
-        memoryview(obj)
-        buf.reset(new PyBuffer(obj))
-        return pyarrow_wrap_buffer(buf)
-    except TypeError:
+    buf.reset(new PyBuffer(obj))
+    if buf.get().data() == NULL:
+        # XXX should be TypeError?  Can we find a way to propagate the
 
 Review comment:
   @wesm What do you think about this? ValueError doesn't sound right here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Python] pa.frombuffer(bytearray) returns immutable Buffer
> ----------------------------------------------------------
>
>                 Key: ARROW-2155
>                 URL: https://issues.apache.org/jira/browse/ARROW-2155
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Antoine Pitrou
>            Assignee: Antoine Pitrou
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> I'd expect it to return a mutable buffer:
> {code:python}
> >>> pa.frombuffer(bytearray(10)).is_mutable
> False
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to