diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2019-12-10 09:25:07 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-10 09:36:34 +0100 |
| commit | 09341856ed9008875c1cc883dc0c287670131458 (patch) | |
| tree | c066dbbe774400b531d74828d4cb36745ef7c022 /django/db/models/sql/query.py | |
| parent | 3df3c5e67070949887e08282a332cc34c1f05184 (diff) | |
Used Signature API instead of deprecated inspect.getcallargs().
inspect.getcallargs() was deprecated in Python 3.5 and the Signature
API (PEP 362) has better support for decorated functions (by default,
it follows the __wrapped__ attribute set by functools.wraps for
example).
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 988689485c..d002698c63 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1916,9 +1916,8 @@ class Query(BaseExpression): group_by = list(self.select) if self.annotation_select: for alias, annotation in self.annotation_select.items(): - try: - inspect.getcallargs(annotation.get_group_by_cols, alias=alias) - except TypeError: + signature = inspect.signature(annotation.get_group_by_cols) + if 'alias' not in signature.parameters: annotation_class = annotation.__class__ msg = ( '`alias=None` must be added to the signature of ' |
