mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#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.
This commit is contained in:
parent
d696732025
commit
685b3495e1
3 changed files with 9 additions and 1 deletions
|
@ -7,6 +7,7 @@ Eventually HeaderRegistry will be a public API, but it isn't yet,
|
|||
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):
|
||||
return self._params.copy()
|
||||
return MappingProxyType(self._params)
|
||||
|
||||
|
||||
class ContentTypeHeader(ParameterizedMIMEHeader):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue