diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2021-12-11 21:12:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-11 21:12:17 (GMT) |
commit | e029c53e1a408b89a4e3edf30a9b38b094f9c880 (patch) | |
tree | a439835a4dd477b67b500e5d09ff82b739973791 /Lib/test/test_exceptions.py | |
parent | bfc59ed0a00106f5ba4a32a0c5b3dbe71d12665d (diff) | |
download | cpython-e029c53e1a408b89a4e3edf30a9b38b094f9c880.zip cpython-e029c53e1a408b89a4e3edf30a9b38b094f9c880.tar.gz cpython-e029c53e1a408b89a4e3edf30a9b38b094f9c880.tar.bz2 |
bpo-44674: Use unhashability as a proxy for mutability for default dataclass __init__ arguments. (GH-29867)
`@dataclass` in 3.10 prohibits using list, dict, or set as default values. It does this to avoid the mutable default problem. This test is both too strict, and not strict enough. Too strict, because some immutable subclasses should be safe, and not strict enough, because other mutable types should be prohibited. With this change applied, `@dataclass` now uses unhashability as a proxy for mutability: if objects aren't hashable, they're assumed to be mutable.
Diffstat (limited to 'Lib/test/test_exceptions.py')
0 files changed, 0 insertions, 0 deletions