cpython: fea3ddcaf652 (original) (raw)

Mercurial > cpython

changeset 93118:fea3ddcaf652 3.4

#21991: make headerregistry params property MappingProxyType. It is unlikely anyone is using the fact that the dictionary returned by the 'params' attribute was previously writable, but even if someone is the API is provisional so this kind of change is acceptable (and needed, to get the API "right" before it becomes official). Patch by Stéphane Wirtel. [#21991]

R David Murray rdmurray@bitdance.com
date Fri, 17 Oct 2014 19:30:13 -0400
parents 9ec84f9b61c6
children 5beb1ea76f36 e9cb45ccf42b
files Lib/email/headerregistry.py Lib/test/test_email/test_headerregistry.py Misc/NEWS
diffstat 3 files changed, 9 insertions(+), 1 deletions(-)[+] [-] Lib/email/headerregistry.py 3 Lib/test/test_email/test_headerregistry.py 3 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/email/headerregistry.py +++ b/Lib/email/headerregistry.py @@ -7,6 +7,7 @@ Eventually HeaderRegistry will be a publ and will probably change some before that happens. """ +from types import MappingProxyType from email import utils from email import errors @@ -454,7 +455,7 @@ class ParameterizedMIMEHeader: @property def params(self):

class ContentTypeHeader(ParameterizedMIMEHeader):

--- a/Lib/test/test_email/test_headerregistry.py +++ b/Lib/test/test_email/test_headerregistry.py @@ -1,6 +1,7 @@ import datetime import textwrap import unittest +import types from email import errors from email import policy from email.message import Message @@ -235,6 +236,8 @@ class TestContentTypeHeader(TestHeaderBa self.assertEqual(h.maintype, maintype) self.assertEqual(h.subtype, subtype) self.assertEqual(h.params, parmdict)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -33,6 +33,10 @@ Core and Builtins Library ------- +- Issue #21991: Make email.headerregistry's header 'params' attributes