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

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

wesm commented on a change in pull request #1626: ARROW-2171: [C++/Python] Make 
OwnedRef safer
URL: https://github.com/apache/arrow/pull/1626#discussion_r169119011
 
 

 ##########
 File path: cpp/src/arrow/python/common.h
 ##########
 @@ -67,9 +67,12 @@ class ARROW_EXPORT PyAcquireGIL {
 class ARROW_EXPORT OwnedRef {
  public:
   OwnedRef() : obj_(NULLPTR) {}
-
+  OwnedRef(const OwnedRef&) = delete;
+  OwnedRef(OwnedRef&& other) : OwnedRef(other.detach()) {}
   explicit OwnedRef(PyObject* obj) : obj_(obj) {}
 
+  OwnedRef& operator=(const OwnedRef&) = delete;
 
 Review comment:
   Can you use the `ARROW_DISALLOW_COPY_AND_ASSIGN` macro for this, and put it 
in `private:` scope? Example: 
https://github.com/apache/arrow/blob/master/cpp/src/arrow/record_batch.h#L161

----------------------------------------------------------------
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] OwnedRef is fragile
> ----------------------------
>
>                 Key: ARROW-2171
>                 URL: https://issues.apache.org/jira/browse/ARROW-2171
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Antoine Pitrou
>            Assignee: Antoine Pitrou
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> Some uses of OwnedRef can implicitly invoke its (default) copy constructor, 
> which will lead to extraneous decrefs.



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

Reply via email to