nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: python-zk/kazoo
Pull request #365 (2015-11-13 19:13:52)

construct empty exceptions with no arguments, instead of () and {}
Here's a simple change to get rid of the weird exceptions with `()` and `{}` passed as arguments.

No tests failed by this change, so I guess it's reasonably backwards-compatible; I did add a simple test for the new behavior.

This partially addresses #362.



Patch:
diff --git a/docs/conf.py b/docs/conf.py
index 715ebd7..6983567 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -63,12 +63,10 @@ copyright = u'2011-2014, Kazoo team'
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
-# The full version, including alpha/beta/rc tags.
-from kazoo import version
-release = version.__version__
-
 # The short X.Y version.
-version = '.'.join(release.split('.')[:-1])
+version = '2.0'
+# The full version, including alpha/beta/rc tags.
+release = '2.0.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/kazoo/exceptions.py b/kazoo/exceptions.py
index 6f32b4f..eeefe49 100644
--- a/kazoo/exceptions.py
+++ b/kazoo/exceptions.py
@@ -52,10 +52,7 @@ EXCEPTIONS = defaultdict(_invalid_error_code)
 
 def _zookeeper_exception(code):
     def decorator(klass):
-        def create(*args, **kwargs):
-            return klass(args, kwargs)
-
-        EXCEPTIONS[code] = create
+        EXCEPTIONS[code] = klass
         klass.code = code
         return klass
 


Test patch:
diff --git a/kazoo/tests/test_exceptions.py b/kazoo/tests/test_exceptions.py
index 154bcb7..eac65c4 100644
--- a/kazoo/tests/test_exceptions.py
+++ b/kazoo/tests/test_exceptions.py
@@ -20,3 +20,9 @@ class ExceptionsTestCase(TestCase):
     def test_invalid_code(self):
         module = self._get()
         self.assertRaises(RuntimeError, module.EXCEPTIONS.__getitem__, 666)
+
+    def test_exceptions_construction(self):
+        module = self._get()
+        exc = module.EXCEPTIONS[-101]()
+        assert type(exc) is module.NoNodeError
+        assert exc.args == ()