Merge pull request #77 from AnthonyDiGirolamo/py311fix
Fix Python 3.11 inspect usage
diff --git a/compiler/util/traverse_ir.py b/compiler/util/traverse_ir.py
index b1e33f8..c9ff71a 100644
--- a/compiler/util/traverse_ir.py
+++ b/compiler/util/traverse_ir.py
@@ -21,8 +21,8 @@
def _call_with_optional_args(function, positional_arg, keyword_args):
"""Calls function with whatever keyword_args it will accept."""
- argspec = inspect.getargspec(function)
- if argspec.keywords:
+ argspec = inspect.getfullargspec(function)
+ if argspec.kwonlyargs:
# If the function accepts a kwargs parameter, then it will accept all
# arguments.
# Note: this isn't technically true if one of the keyword arguments has the