Skip to content

Commit b19fc95

Browse files
authored
Fix classmethod wrapping (googleapis#5826)
1 parent d6fe5e1 commit b19fc95

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pubsub/google/cloud/pubsub_v1/_gapic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def wrap(wrapped_fx):
3232
# Similarly, for instance methods, we need to send self.api rather
3333
# than self, since that is where the actual methods were declared.
3434
instance_method = True
35+
36+
# If this is a bound method it's a classmethod.
3537
self = getattr(wrapped_fx, '__self__', None)
3638
if issubclass(type(self), type):
3739
instance_method = False
@@ -41,8 +43,9 @@ def wrap(wrapped_fx):
4143
if instance_method:
4244
fx = lambda self, *a, **kw: wrapped_fx(self.api, *a, **kw) # noqa
4345
return functools.wraps(wrapped_fx)(fx)
44-
fx = lambda self, *a, **kw: wrapped_fx(*a, **kw) # noqa
45-
return functools.wraps(wrapped_fx)(fx)
46+
47+
fx = lambda *a, **kw: wrapped_fx(*a, **kw) # noqa
48+
return staticmethod(functools.wraps(wrapped_fx)(fx))
4649

4750
def actual_decorator(cls):
4851
# Reflectively iterate over most of the methods on the source class

0 commit comments

Comments
 (0)