summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-11-02 20:19:56 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-11-02 20:19:56 (GMT)
commit2cb0e73a89589ce56ba17da39a06f8017cfc92e4 (patch)
tree8180efd154004c2ba0fa67a923e5f4f9a381494c /Lib/http
parent030dbb91a92096c0a7611f2e0c711035622b5669 (diff)
parent8cf7c1cff0f1176387118826fffdf1c517405f3a (diff)
downloadcpython-2cb0e73a89589ce56ba17da39a06f8017cfc92e4.zip
cpython-2cb0e73a89589ce56ba17da39a06f8017cfc92e4.tar.gz
cpython-2cb0e73a89589ce56ba17da39a06f8017cfc92e4.tar.bz2
Issue #22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2
and above. Patch by Tim Graham.
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/cookies.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index 556d101..a6de6d5 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -486,8 +486,12 @@ class BaseCookie(dict):
def __setitem__(self, key, value):
"""Dictionary style assignment."""
- rval, cval = self.value_encode(value)
- self.__set(key, rval, cval)
+ if isinstance(value, Morsel):
+ # allow assignment of constructed Morsels (e.g. for pickling)
+ dict.__setitem__(self, key, value)
+ else:
+ rval, cval = self.value_encode(value)
+ self.__set(key, rval, cval)
def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"):
"""Return a string suitable for HTTP."""