Skip to content

Commit f3e452f

Browse files
authored
fix: inspect.getargspec removed on 3.11. Closes #316 (#317)
1 parent 2ccbadb commit f3e452f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

statemachine/dispatcher.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ def methodcaller(method):
3131
# args is a list of the argument names (it may contain nested lists)
3232
# varargs and keywords are the names of the * and ** arguments or None
3333
# defaults is a tuple of default argument values or None if there are no default arguments
34-
spec = inspect.getargspec(method)
35-
keywords = spec.keywords
34+
try:
35+
spec = inspect.getfullargspec(method)
36+
except AttributeError: # pragma: no cover
37+
spec = inspect.getargspec(method)
38+
keywords = getattr(spec, "varkw", getattr(spec, "keywords", None))
3639
expected_args = list(spec.args)
3740
expected_kwargs = spec.defaults or {}
3841

tox.ini

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27, py35, py36, py37, py38, lint
2+
envlist = py27, py35, py36, py37, py38, py39, py310, py311, lint
33

44
[testenv]
55
setenv =
@@ -28,8 +28,20 @@ commands =
2828

2929
basepython =
3030
lint: python3.8
31+
py311: python3.11
32+
py310: python3.10
33+
py39: python3.9
3134
py38: python3.8
3235
py37: python3.7
3336
py36: python3.6
3437
py35: python3.5
3538
py27: python2.7
39+
40+
[testenv:py311]
41+
deps =
42+
pytest>5
43+
pytest-cov
44+
pytest-flake8
45+
flake8==3.7.9
46+
pydot
47+
mock

0 commit comments

Comments
 (0)