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

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

wesm commented on a change in pull request #1405: ARROW-1908: [Python] 
Construction of arrow table from pandas DataFrame with duplicate column names 
crashes
URL: https://github.com/apache/arrow/pull/1405#discussion_r155938210
 
 

 ##########
 File path: cpp/src/arrow/python/builtin_convert.cc
 ##########
 @@ -165,18 +164,26 @@ class SeqVisitor {
         if (PyArray_Check(obj)) {
           auto array = reinterpret_cast<PyArrayObject*>(obj);
           auto ptr = reinterpret_cast<const char*>(PyArray_GETPTR1(array, i));
+
           ref.reset(PyArray_GETITEM(array, ptr));
+          RETURN_IF_PYERROR();
+
           RETURN_NOT_OK(VisitElem(ref, level));
         } else {
           ref.reset(PySequence_GetItem(obj, i));
+          RETURN_IF_PYERROR();
           RETURN_NOT_OK(VisitElem(ref, level));
         }
       }
     } else if (PyObject_HasAttrString(obj, "__iter__")) {
-      OwnedRef iter = OwnedRef(PyObject_GetIter(obj));
-      PyObject* item;
+      OwnedRef iter(PyObject_GetIter(obj));
+      RETURN_IF_PYERROR();
+
+      PyObject* item = NULLPTR;
 
 Review comment:
   For future reference, no need to use the macro form of null here, since 
C++/CLI only is impacted by the header files, I think

----------------------------------------------------------------
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:
[email protected]


> [Python] Construction of arrow table from pandas DataFrame with duplicate 
> column names crashes
> ----------------------------------------------------------------------------------------------
>
>                 Key: ARROW-1908
>                 URL: https://issues.apache.org/jira/browse/ARROW-1908
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.7.1
>            Reporter: Phillip Cloud
>            Assignee: Phillip Cloud
>              Labels: pandas, pull-request-available, python
>             Fix For: 0.8.0
>
>
> [~jorisvandenbossche]'s example here: 
> https://github.com/pandas-dev/pandas/pull/18201#issuecomment-350259248 shows 
> that a {{pyarrow.Table}} with duplicate column names can be constructed.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to