From 1a54a8332e9398f18c6c4f8258f4853f2cc53013 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 25 Dec 2022 09:26:31 -0400 Subject: [PATCH] Migrate to inspect.getfullargspec() getargspec() was deprecated in 3.0 and removed in 3.11. Forwarded: https://github.com/enkore/i3pystatus/pull/844 Bug-Debian: https://bugs.debian.org/1024915 --- i3pystatus/core/modules.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/i3pystatus/core/modules.py +++ b/i3pystatus/core/modules.py @@ -121,13 +121,14 @@ tmp_cb = cb try: - args_spec = inspect.getargspec(tmp_cb) + args_spec = inspect.getfullargspec(tmp_cb) except Exception: - args_spec = inspect.ArgSpec([], None, None, None) + args_spec = inspect.FullArgSpec( + [], None, None, None, None, None, {}) # Remove all variables present in kwargs that are not used in the # callback, except if there is a keyword argument. - if not args_spec.keywords: + if not args_spec.varkw: kwargs = {k: v for k, v in kwargs.items() if k in args_spec.args} cb(*args, **kwargs)