Przeglądaj źródła

ZOOKEEPER-853: Make zookeeper.is_unrecoverable return True or False in
zkpython

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@990941 13f79535-47bb-0310-9956-ffa450edef68

Henry Robinson 15 lat temu
rodzic
commit
efa17f96f0

+ 3 - 0
CHANGES.txt

@@ -114,6 +114,9 @@ IMPROVEMENTS:
 
   ZOOKEEPER-733. use netty to handle client connections (breed and phunt)
 
+  ZOOKEEPER-853. Make zookeeper.is_unrecoverable return True or False
+  in zkpython (Andrei Savu via henryr)
+
 NEW FEATURES:
   ZOOKEEPER-729. Java client API to recursively delete a subtree.
   (Kay Kay via henry)

+ 1 - 1
src/contrib/zkpython/src/c/pyzk_docstrings.h

@@ -287,7 +287,7 @@ const char pyzk_is_unrecoverable_doc[] =
 " zh the zookeeper handle (see zookeeper.init)\n"
 "\n"
 "RETURNS:\n"
-  "INVALIDSTATE if connection is unrecoverable\n";
+  "True if connection is unrecoverable, otherwise False\n";
 
 const char pyzk_set_debug_level_doc[] = 
 "\brief sets the debugging level for the library \n"

+ 4 - 2
src/contrib/zkpython/src/c/zookeeper.c

@@ -1387,7 +1387,7 @@ PyObject *pyzoo_recv_timeout(PyObject *self, PyObject *args)
   return Py_BuildValue("i",recv_timeout);  
 }
 
-/* Returns > 0 if connection is unrecoverable, 0 otherwise */
+/* Returns True if connection is unrecoverable, False otherwise */
 PyObject *pyis_unrecoverable(PyObject *self, PyObject *args)
 {
   int zkhid;
@@ -1395,7 +1395,9 @@ PyObject *pyis_unrecoverable(PyObject *self, PyObject *args)
     return NULL;
   CHECK_ZHANDLE(zkhid);
   int ret = is_unrecoverable(zhandles[zkhid]);
-  return Py_BuildValue("i",ret); // TODO: make this a boolean
+  if (ret > 0)
+    Py_RETURN_TRUE;
+  Py_RETURN_FALSE;
 }
 
 /* Set the debug level for logging, returns None */