summaryrefslogtreecommitdiff
path: root/django/urls
diff options
context:
space:
mode:
authorJonathan Davis <jonathandavis4@users.noreply.github.com>2021-07-29 06:04:56 +0100
committerGitHub <noreply@github.com>2021-07-29 07:04:56 +0200
commit4c6a6d5ac7aa348d5b4b9a4d6bb7cc18af49f72a (patch)
tree50d1e37c7b89cdfee53f60733cb2e83238ffe671 /django/urls
parent85d47a58bf7dceced6a3e29a0715827b7a9d7d29 (diff)
Fixed #23895 -- Prevented pickling of ResolverMatch.
Pickling a ResolverMatch did not work correctly in many cases, especially with CBVs and URLResolvers in the list of tried URL paths.
Diffstat (limited to 'django/urls')
-rw-r--r--django/urls/resolvers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index 3a53bce1de..6ea18dd22f 100644
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -10,6 +10,7 @@ import inspect
import re
import string
from importlib import import_module
+from pickle import PicklingError
from urllib.parse import quote
from asgiref.local import Local
@@ -71,6 +72,9 @@ class ResolverMatch:
)
)
+ def __reduce_ex__(self, protocol):
+ raise PicklingError(f'Cannot pickle {self.__class__.__qualname__}.')
+
def get_resolver(urlconf=None):
if urlconf is None: