[
https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763901#action_12763901
]
Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------
Hm, I had interpreted the Python documentation differently, by analogy with
PyModule_AddIntConstant. I also tested but couldn't force a GC error. This is
what I just tried:
>>> import zookeeper
>>> import gc
>>> gc.collect()
0
>>> zookeeper.set(0,"/","test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
zookeeper.ZooKeeperException: zhandle out of range
I also tried removing the reference from the module before doing the gc, via
del zookeeper.ZooKeeperException.
However, I think you're right, by looking at other usage examples. I think it's
acceptable to take the examples in the Python manual as canonical, so I support
reinstating that line.
The patch is simple, but I'm not sure how best to test it. Perhaps forcing an
exception pointer to NULL via a C module call, but then that would pollute the
object's namespace. A test module that wasn't shipped, but built for testing?
> zkpython lumps all exceptions as IOError, needs specialized exceptions for
> KeeperException types
> ------------------------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-510
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
> Project: Zookeeper
> Issue Type: Bug
> Components: contrib-bindings
> Affects Versions: 3.2.0
> Reporter: Patrick Hunt
> Assignee: Henry Robinson
> Fix For: 3.3.0
>
> Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch,
> ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even
> for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error
> prone) to handle exceptions in python code. You can't easily pickup a
> connection loss vs a node exists for example. Of course you could match the
> error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map
> directly to KeeperException/java types. It would also be useful to include
> the information provided by the KeeperException (like path in some cases),
> etc... as part of the error thrown to the python code. Would probably be a
> good idea to stay as close to java api as possible wrt mapping the errors.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.