Skip to content

Commit

Permalink
Fix a FuncContext class error affecting Python 3.11 users
Browse files Browse the repository at this point in the history
Re: #377.

This class now uses the inspect module's `getfullargspec' function,
instead of the old deprecated one, on Python version 3 and above.
  • Loading branch information
drmfinlay committed Jun 30, 2023
1 parent 481a4d5 commit 7dc435f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dragonfly/grammar/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ class that evaluates a given function/lambda/callable, whose return
import inspect
import logging

from six import PY2, string_types

# --------------------------------------------------------------------------
from six import string_types


class Context(object):
Expand Down Expand Up @@ -389,8 +389,8 @@ def __init__(self, function, **defaults):
self._function = function
self._defaults = defaults
self._str = "%s, defaults: %s" % (self._function, self._defaults)

(args, _, varkw, defaults) = inspect.getargspec(self._function)
getargspec = inspect.getargspec if PY2 else inspect.getfullargspec
(args, _, varkw, defaults) = getargspec(self._function)[0:4]
if varkw: self._filter_keywords = False
else: self._filter_keywords = True
self._valid_keywords = set(args)
Expand Down

0 comments on commit 7dc435f

Please sign in to comment.