From a20e69dbe9e251e867ca7c12b47ee964e5c09708 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 1 Jun 2021 15:42:17 +0800 Subject: [PATCH] Replace bare exception from getfullargspec getfullargspec is based on signature, which is documented to raise TypeError and ValueError. Related to https://github.com/capnproto/pycapnp/issues/254 --- capnp/lib/capnp.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index f01a63a..0ff15a4 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -1974,7 +1974,7 @@ cdef class _Promise: argspec = None try: argspec = _inspect.getfullargspec(func) - except: + except (TypeError, ValueError): pass if argspec: args_length = len(argspec.args) if argspec.args else 0 @@ -2042,7 +2042,7 @@ cdef class _VoidPromise: argspec = None try: argspec = _inspect.getfullargspec(func) - except: + except (TypeError, ValueError): pass if argspec: args_length = len(argspec.args) if argspec.args else 0 @@ -2146,7 +2146,7 @@ cdef class _RemotePromise: argspec = None try: argspec = _inspect.getfullargspec(func) - except: + except (TypeError, ValueError): pass if argspec: args_length = len(argspec.args) if argspec.args else 0