summaryrefslogtreecommitdiff
path: root/django/dispatch
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-03-01 09:22:03 -0800
committerCarlton Gibson <carlton@noumenal.es>2020-03-05 09:38:52 +0100
commit769cee525222bb155735aba31d6174d73c271f3c (patch)
treeeeaee53a694669e78a63c9da96da93db1ca0c9b8 /django/dispatch
parent5ca76baa729bbbe62f5c4a0fc4f89747dc999029 (diff)
Fixed #31327 -- Deprecated providing_args argument for Signal.
Diffstat (limited to 'django/dispatch')
-rw-r--r--django/dispatch/dispatcher.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index 910024371b..b7d9d26389 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -1,6 +1,8 @@
import threading
+import warnings
import weakref
+from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.inspect import func_accepts_kwargs
@@ -28,14 +30,16 @@ class Signal:
def __init__(self, providing_args=None, use_caching=False):
"""
Create a new signal.
-
- providing_args
- A list of the arguments this signal can pass along in a send() call.
"""
self.receivers = []
- if providing_args is None:
- providing_args = []
- self.providing_args = set(providing_args)
+ if providing_args is not None:
+ warnings.warn(
+ 'The providing_args argument is deprecated. As it is purely '
+ 'documentational, it has no replacement. If you rely on this '
+ 'argument as documentation, you can move the text to a code '
+ 'comment or docstring.',
+ RemovedInDjango40Warning, stacklevel=2,
+ )
self.lock = threading.Lock()
self.use_caching = use_caching
# For convenience we create empty caches even if they are not used.
@@ -187,9 +191,7 @@ class Signal:
occur).
named
- Named arguments which will be passed to receivers. These
- arguments must be a subset of the argument names defined in
- providing_args.
+ Named arguments which will be passed to receivers.
Return a list of tuple pairs [(receiver, response), ... ].