Skip to content

Commit

Permalink
Update expressions.py
Browse files Browse the repository at this point in the history
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 <module>
    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
  • Loading branch information
RaduGeorgescu committed Jul 2, 2024
1 parent 67dfaac commit 7c70413
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parsimonious/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c70413

Please sign in to comment.