From 630778bdb650ac2937e5b1cb1044c5b618231140 Mon Sep 17 00:00:00 2001 From: Anton Soroko Date: Fri, 10 Nov 2023 15:00:53 +0300 Subject: [PATCH] use getargspec only with Python 2 --- lib/cherrypy/_cpdispatch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cherrypy/_cpdispatch.py b/lib/cherrypy/_cpdispatch.py index 83eb79c..79a8a54 100644 --- a/lib/cherrypy/_cpdispatch.py +++ b/lib/cherrypy/_cpdispatch.py @@ -206,12 +206,14 @@ def test_callable_spec(callable, callable_args, callable_kwargs): def test_callable_spec(callable, args, kwargs): # noqa: F811 return None else: - getargspec = inspect.getargspec # Python 3 requires using getfullargspec if # keyword-only arguments are present if hasattr(inspect, 'getfullargspec'): def getargspec(callable): return inspect.getfullargspec(callable)[:4] + # Use getargspec with Python 2 + else: + getargspec = inspect.getargspec class LateParamPageHandler(PageHandler):