diff -r d564695b67bb Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst Fri Mar 20 00:27:28 2015 +0100 +++ b/Doc/library/http.cookies.rst Thu Mar 19 22:10:31 2015 -0700 @@ -144,6 +144,23 @@ The keys are case-insensitive. +.. versionchanged:: 3.5 + + :func:`Morsel.__eq__` now takes :attr:`Morsel.key` and :attr:`Morsel.value` + into account. + +.. versionchanged:: 3.5 + + :func:`Morsel.copy` now results in a :class:`Morsel` instance rather than a + *dict* + +.. versionchanged:: 3.5 + + The behaviour of :func:`Morsel.update` is now consistent with + :func:`Morsel.__setitem__` in that setting invalid attributes will raise an + exception. + + .. attribute:: Morsel.value The value of the cookie. @@ -175,6 +192,11 @@ Set the *key*, *value* and *coded_value* attributes. + .. deprecated:: 3.5 + + The undocumented *LegalChars* parameter is ignored and will be removed in + future versions. + .. method:: Morsel.isReservedKey(K) diff -r d564695b67bb Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst Fri Mar 20 00:27:28 2015 +0100 +++ b/Doc/whatsnew/3.5.rst Thu Mar 19 22:10:31 2015 -0700 @@ -518,6 +518,9 @@ :func:`~http.cookies.Morsel.set` method in order to avoid the deprecation warning. +* The undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` + has been deprecated and is now ignored. + Deprecated functions and types of the C API ------------------------------------------- diff -r d564695b67bb Lib/http/cookies.py --- a/Lib/http/cookies.py Fri Mar 20 00:27:28 2015 +0100 +++ b/Lib/http/cookies.py Thu Mar 19 22:10:31 2015 -0700 @@ -366,7 +366,13 @@ def isReservedKey(self, K): return K.lower() in self._reserved - def set(self, key, val, coded_val): + def set(self, key, val, coded_val, LegalChars=_LegalChars): + if LegalChars != _LegalChars: + import warnings + warnings.warn( + 'LegalChars parameter is deprecated, ignored and will ' + 'be removed in future versions.', DeprecationWarning) + if key.lower() in self._reserved: raise CookieError('Attempt to set a reserved key %r' % (key,)) if not _is_legal_key(key): diff -r d564695b67bb Lib/test/test_http_cookies.py --- a/Lib/test/test_http_cookies.py Fri Mar 20 00:27:28 2015 +0100 +++ b/Lib/test/test_http_cookies.py Thu Mar 19 22:10:31 2015 -0700 @@ -261,6 +261,8 @@ morsel.value = '' with self.assertWarnsRegex(DeprecationWarning, r'\bcoded_value\b'): morsel.coded_value = '' + with self.assertWarnsRegex(DeprecationWarning, r'\bLegalChars\b'): + morsel.set('key', 'value', 'coded_value', LegalChars='.*') def test_eq(self): base_case = ('key', 'value', '"value"')