summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2020-04-12 14:27:41 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-04-12 14:27:41 +0200
commit46bdd807306b30677772537f1e740eef1e6fd36a (patch)
tree7a8bdaca1ac2737bee40cdc62543c5d2f75f0310
parent8ee6e86e1d634c2ea6b4b0d37c09a744a184bb6d (diff)
downloadcython-46bdd807306b30677772537f1e740eef1e6fd36a.tar.gz
Remove dead fallback code: inspect.getcallargs() was added in Py2.7.
-rw-r--r--Cython/Build/Inline.py33
1 files changed, 1 insertions, 32 deletions
diff --git a/Cython/Build/Inline.py b/Cython/Build/Inline.py
index 813ba5cd1..c56701b58 100644
--- a/Cython/Build/Inline.py
+++ b/Cython/Build/Inline.py
@@ -330,37 +330,6 @@ def extract_func_code(code):
return '\n'.join(module), ' ' + '\n '.join(function)
-try:
- from inspect import getcallargs
-except ImportError:
- def getcallargs(func, *arg_values, **kwd_values):
- all = {}
- args, varargs, kwds, defaults = inspect.getargspec(func)
- if varargs is not None:
- all[varargs] = arg_values[len(args):]
- for name, value in zip(args, arg_values):
- all[name] = value
- for name, value in list(kwd_values.items()):
- if name in args:
- if name in all:
- raise TypeError("Duplicate argument %s" % name)
- all[name] = kwd_values.pop(name)
- if kwds is not None:
- all[kwds] = kwd_values
- elif kwd_values:
- raise TypeError("Unexpected keyword arguments: %s" % list(kwd_values))
- if defaults is None:
- defaults = ()
- first_default = len(args) - len(defaults)
- for ix, name in enumerate(args):
- if name not in all:
- if ix >= first_default:
- all[name] = defaults[ix - first_default]
- else:
- raise TypeError("Missing argument: %s" % name)
- return all
-
-
def get_body(source):
ix = source.index(':')
if source[:5] == 'lambda':
@@ -378,7 +347,7 @@ class RuntimeCompiledFunction(object):
self._body = get_body(inspect.getsource(f))
def __call__(self, *args, **kwds):
- all = getcallargs(self._f, *args, **kwds)
+ all = inspect.getcallargs(self._f, *args, **kwds)
if IS_PY3:
return cython_inline(self._body, locals=self._f.__globals__, globals=self._f.__globals__, **all)
else: