Skip to content

Instantly share code, notes, and snippets.

@mtwebster
Created August 24, 2023 14:09
Show Gist options
  • Save mtwebster/f6be42f5812bd8b227b9c831e26879c6 to your computer and use it in GitHub Desktop.
Save mtwebster/f6be42f5812bd8b227b9c831e26879c6 to your computer and use it in GitHub Desktop.
diff --git a/__init__.py b/__init__.py
index 3dff370..3b27f4f 100644
--- a/__init__.py
+++ b/__init__.py
@@ -129,7 +129,7 @@ class DeferredException(object):
if PY3K:
raise self.value.with_traceback(self.traceback)
else:
- raise self.type, self.value, self.traceback
+ raise (self.type, self.value, self.traceback)
def catch(self, *errors):
"""Check if the stored exception is a subclass of one of the
@@ -260,8 +260,8 @@ class Deferred(object):
>>> deferred.result
'Got: catched'
"""
- assert isinstance(callback, collections.Callable)
- assert errback is None or isinstance(errback, collections.Callable)
+ assert isinstance(callback, collections.abc.Callable)
+ assert errback is None or isinstance(errback, collections.abc.Callable)
if errback is None:
errback = _passthrough
self.callbacks.append(((callback,
@@ -432,7 +432,7 @@ def defer(func, *args, **kwargs):
>>> defer(lambda: deferred) == deferred
True
"""
- assert isinstance(func, collections.Callable)
+ assert isinstance(func, collections.abc.Callable)
try:
result = func(*args, **kwargs)
except:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment