Author: phunt
Date: Thu Nov 19 22:07:18 2009
New Revision: 882321

URL: http://svn.apache.org/viewvc?rev=882321&view=rev
Log:
ZOOKEEPER-538. zookeeper.async causes python to segfault

Modified:
    hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
    hadoop/zookeeper/branches/branch-3.2/src/contrib/zkpython/src/c/zookeeper.c

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=882321&r1=882320&r2=882321&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Thu Nov 19 22:07:18 2009
@@ -7,6 +7,9 @@
   ZOOKEEPER-420. build/test should not require install in zkpython
   (henry robinson via phunt)
 
+  ZOOKEEPER-538. zookeeper.async causes python to segfault
+  (henry robinson via phunt)
+
   ZOOKEEPER-562. c client can flood server with pings if tcp send queue
   filled. (ben reed via mahadev)
 

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkpython/src/c/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/contrib/zkpython/src/c/zookeeper.c?rev=882321&r1=882320&r2=882321&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.2/src/contrib/zkpython/src/c/zookeeper.c 
(original)
+++ hadoop/zookeeper/branches/branch-3.2/src/contrib/zkpython/src/c/zookeeper.c 
Thu Nov 19 22:07:18 2009
@@ -205,6 +205,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i)", pyw->zhandle, rc);
@@ -218,6 +220,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i,N)", pyw->zhandle,rc, 
build_stat(stat));
@@ -231,6 +235,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i,s#,O)", pyw->zhandle,rc, 
value,value_len, build_stat(stat));
@@ -244,6 +250,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i,O)", pyw->zhandle,rc, 
build_string_vector(strings));
@@ -257,6 +265,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i,s)", pyw->zhandle,rc, value);
@@ -270,6 +280,8 @@
 {
   PyGILState_STATE gstate;
   pywatcher_t *pyw = (pywatcher_t*)data;
+  if (pyw == NULL)
+    return;
   PyObject *callback = pyw->callback;
   gstate = PyGILState_Ensure();
   PyObject *arglist = Py_BuildValue("(i,i,O,O)", pyw->zhandle,rc, 
build_acls(acl), build_stat(stat));
@@ -299,7 +311,7 @@
                         valuelen,
                         pyacls == Py_None ? NULL : &acl,
                         flags,
-                        completion_callback != Py_None ? 
string_completion_dispatch : NULL,
+                        string_completion_dispatch,
                         completion_callback != Py_None ? 
create_pywatcher(zkhid, completion_callback,0 ) : NULL );
     
   free_acls(&acl);
@@ -322,7 +334,7 @@
   int err = zoo_adelete( zhandles[zkhid],
                         path,
                         version,
-                        completion_callback != Py_None ? 
void_completion_dispatch : NULL,
+                        void_completion_dispatch,
                         completion_callback != Py_None ? 
create_pywatcher(zkhid, 
                                                                           
completion_callback,
                                                                           0 ) 
: NULL );
@@ -349,7 +361,7 @@
                          path,
                          exists_watch != Py_None ? watcher_dispatch : NULL,
                          exists_watch != Py_None ? create_pywatcher(zkhid, 
exists_watch,0) : NULL,
-                         (completion_callback != Py_None) ? 
stat_completion_dispatch : NULL,
+                         stat_completion_dispatch,
                          (completion_callback != Py_None) ? 
create_pywatcher(zkhid, completion_callback,0) : NULL );
     
   if (err != ZOK)
@@ -374,7 +386,7 @@
                       path,
                       get_watch != Py_None ? watcher_dispatch : NULL,
                       get_watch != Py_None ? create_pywatcher(zkhid, 
get_watch,0) : NULL,
-                      completion_callback != Py_None ? 
data_completion_dispatch : NULL,
+                      data_completion_dispatch,
                       completion_callback != Py_None ? 
                       create_pywatcher(zkhid, completion_callback,0 ) : NULL );
     
@@ -399,7 +411,7 @@
                      buffer,
                      buflen,
                      version,
-                     completion_callback != Py_None ? stat_completion_dispatch 
: NULL,
+                     stat_completion_dispatch,
                      completion_callback != Py_None ? create_pywatcher(zkhid, 
                                                                        
completion_callback,
                                                                        0 ) : 
NULL );
@@ -426,7 +438,7 @@
                                path,
                                get_watch != Py_None ? watcher_dispatch : NULL,
                                get_watch != Py_None ? create_pywatcher(zkhid, 
get_watch,0) : NULL,
-                               completion_callback != Py_None ? 
strings_completion_dispatch : NULL,
+                               strings_completion_dispatch,
                                completion_callback != Py_None ? 
                                create_pywatcher(zkhid, completion_callback,0) 
: NULL );    
   if (err != ZOK)
@@ -448,7 +460,7 @@
 
   int err = zoo_async( zhandles[zkhid],
                       path,
-                      completion_callback != Py_None ? 
string_completion_dispatch : NULL,
+                      string_completion_dispatch,
                       completion_callback != Py_None ? 
                       create_pywatcher(zkhid, completion_callback,0) : NULL ); 
   
   if (err != ZOK)
@@ -470,7 +482,7 @@
 
   int err = zoo_aget_acl( zhandles[zkhid],
                          path,
-                         completion_callback != Py_None ? 
acl_completion_dispatch : NULL,
+                         acl_completion_dispatch,
                          completion_callback != Py_None ? 
                          create_pywatcher(zkhid, completion_callback,0) : NULL 
);
     
@@ -497,7 +509,7 @@
                          path,
                          version,
                          &aclv,
-                         completion_callback != Py_None ? 
void_completion_dispatch : NULL,
+                         void_completion_dispatch,
                          completion_callback != Py_None ? 
                          create_pywatcher(zkhid, completion_callback,0) : NULL 
);
   free_acls(&aclv);


Reply via email to