From 561591252bd029981952c5c229f4cf27832d34a1 Mon Sep 17 00:00:00 2001 From: saarni Date: Thu, 5 Feb 2015 12:14:21 +0200 Subject: use getfullargspec in PY3, allowing annotations in subscribers --- CONTRIBUTORS.txt | 2 ++ pyramid/config/util.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index e4132cda5..adf2224a5 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -238,3 +238,5 @@ Contributors - Hugo Branquinho, 2014/11/25 - Adrian Teng, 2014/12/17 + +- Ilja Everila, 2015/02/05 diff --git a/pyramid/config/util.py b/pyramid/config/util.py index 892592196..b91f3f7ab 100644 --- a/pyramid/config/util.py +++ b/pyramid/config/util.py @@ -22,6 +22,12 @@ ActionInfo = ActionInfo # support bw compat imports MAX_ORDER = 1 << 30 DEFAULT_PHASH = md5().hexdigest() +# support annotations and keyword-only arguments in PY3 +try: + getargspec = inspect.getfullargspec +except AttributeError: + getargspec = inspect.getargspec + def as_sorted_tuple(val): if not is_nonstr_iter(val): val = (val,) @@ -201,7 +207,7 @@ def takes_one_arg(callee, attr=None, argname=None): return False try: - argspec = inspect.getargspec(fn) + argspec = getargspec(fn) except TypeError: return False -- cgit v1.2.3