Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class _KW_ONLY_TYPE:
KW_ONLY = _KW_ONLY_TYPE()

# Since most per-field metadata will be unused, create an empty
# read-only proxy that can be shared among all fields.
_EMPTY_METADATA = types.MappingProxyType({})
# read-only dictionary that can be shared among all fields.
_EMPTY_METADATA = frozendict()

# Markers for the various kinds of fields and pseudo-fields.
class _FIELD_BASE:
Expand Down
4 changes: 1 addition & 3 deletions Lib/email/headerregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
This module provides an implementation of the HeaderRegistry API.
The implementation is designed to flexibly follow RFC5322 rules.
"""
from types import MappingProxyType

from email import utils
from email import errors
from email import _header_value_parser as parser
Expand Down Expand Up @@ -462,7 +460,7 @@ def init(self, *args, **kw):

@property
def params(self):
return MappingProxyType(self._params)
return frozendict(self._params)


class ContentTypeHeader(ParameterizedMIMEHeader):
Expand Down
5 changes: 2 additions & 3 deletions Lib/test/support/hashlib_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import unittest
import unittest.mock
from test.support import import_helper
from types import MappingProxyType


def _parse_fullname(fullname, *, strict=False):
Expand Down Expand Up @@ -351,7 +350,7 @@ def __init__(
)


_HASHINFO_DATABASE = MappingProxyType({
_HASHINFO_DATABASE = frozendict({
_HashId.md5: _HashInfo(
_HashId.md5,
"_md5.MD5Type",
Expand Down Expand Up @@ -500,7 +499,7 @@ def _iter_hash_func_info(excluded):
# keyed hash function. However, as it's exposed by HACL*, we test it.
_HMACINFO_DATABASE[_HashId.blake2s] = _HashInfoItem('_hmac.compute_blake2s_32')
_HMACINFO_DATABASE[_HashId.blake2b] = _HashInfoItem('_hmac.compute_blake2b_32')
_HMACINFO_DATABASE = MappingProxyType(_HMACINFO_DATABASE)
_HMACINFO_DATABASE = frozendict(_HMACINFO_DATABASE)
assert _HMACINFO_DATABASE.keys() == CANONICAL_DIGEST_NAMES


Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dataclasses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_field_repr(self):
expected_output = "Field(name='id',type=None," \
f"default=1,default_factory={MISSING!r}," \
"init=True,repr=False,hash=None," \
"compare=True,metadata=mappingproxy({})," \
"compare=True,metadata=frozendict()," \
f"kw_only={MISSING!r}," \
"doc='Docstring'," \
"_field_type=None)"
Expand Down
5 changes: 2 additions & 3 deletions Lib/test/test_hmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import hmac
import hashlib
import random
import types
import unittest
import warnings
from _operator import _compare_digest as operator_compare_digest
Expand Down Expand Up @@ -303,7 +302,7 @@ def assert_hmac_new_by_name(

def check_hmac_new(
self, key, msg, hexdigest, hashname, digest_size, block_size,
hmac_new_func, hmac_new_kwds=types.MappingProxyType({}),
hmac_new_func, hmac_new_kwds=frozendict(),
):
"""Check that HMAC(key, msg) == digest.
Expand Down Expand Up @@ -349,7 +348,7 @@ def assert_hmac_hexdigest_by_name(

def check_hmac_hexdigest(
self, key, msg, hexdigest, digest_size,
hmac_digest_func, hmac_digest_kwds=types.MappingProxyType({}),
hmac_digest_func, hmac_digest_kwds=frozendict(),
):
"""Check and return a HMAC digest computed by hmac_digest_func().
Expand Down
Loading