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

Henry Robinson commented on ZOOKEEPER-1314:
-------------------------------------------

Hi Daniel - 

Looks good, I didn't know about Py_BEGIN_ALLOW_THREADS!

Just one comment:

{code}
   if (err != ZOK) {
     PyErr_SetString(err_to_exception(err), zerror(err));
-    return NULL;
+    goto cleanup;
   }
 
-  return Py_BuildValue("s", realbuf);
+  returnval = Py_BuildValue("s", realbuf);
+cleanup:
+  free(realbuf);
+  return returnval;
{code}

I'd prefer:

{code}
   if (err != ZOK) {
     PyErr_SetString(err_to_exception(err), zerror(err));
   } else {
     returnval = Py_BuildValue("s", realbuf);
   }
  
+  free(realbuf);
+  return returnval;
{code}

if that's functionally equivalent. 

                
> improve zkpython synchronous api implementation
> -----------------------------------------------
>
>                 Key: ZOOKEEPER-1314
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1314
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: contrib-bindings
>    Affects Versions: 3.3.3
>            Reporter: Daniel Lescohier
>            Assignee: Daniel Lescohier
>            Priority: Minor
>         Attachments: ZOOKEEPER-1314.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Improves the following items in zkpython which are related to the Zookeeper 
> synchronous API:
> # For pyzoo_create, no longer limit the returned znode name to 256 bytes; 
> dynamically allocate memory on the heap.
> # For all the synchronous api calls, release the Python Global Interpreter 
> Lock just before doing the synchronous call.
> I will attach the patch shortly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to