From 7c70413de6c17910677519d1ce1a0bc7146810f1 Mon Sep 17 00:00:00 2001 From: Georgescu Radu <92390017+RaduGeorgescu@users.noreply.github.com> Date: Wed, 3 Jul 2024 00:31:52 +0300 Subject: [PATCH] Update expressions.py in latests python and pip version of 03.07.2024 I discovered this issue File "..../lib/python3.12/site-packages/parsimonious/expressions.py", line 9, in from inspect import getargspec ImportError: cannot import name 'getargspec' from 'inspect' (..../lib/python3.12/inspect.py). Did you mean: 'getargs'? tested it on both linux and windows --- parsimonious/expressions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py index a1cf40b..b92bc01 100644 --- a/parsimonious/expressions.py +++ b/parsimonious/expressions.py @@ -7,7 +7,7 @@ # anything--for speed. And kill all the dots. from collections import defaultdict -from inspect import getfullargspec, isfunction, ismethod, ismethoddescriptor +from inspect import getargs, isfunction, ismethod, ismethoddescriptor try: import regex as re except ImportError: @@ -67,7 +67,7 @@ def foo(text, pos, cache, error, grammar): if ismethoddescriptor(callable) and hasattr(callable, '__func__'): callable = callable.__func__ - num_args = len(getfullargspec(callable).args) + num_args = len(getargs(callable).args) if ismethod(callable): # do not count the first argument (typically 'self') for methods num_args -= 1