[issue44674] dataclasses should allow frozendict default value

2021-12-12 Thread Eric V. Smith
Eric V. Smith added the comment: @gianni: can you verify that your use case works in 3.11? -- ___ Python tracker ___ ___ Python-bug

[issue44674] dataclasses should allow frozendict default value

2021-12-11 Thread Gianni Mariani
Gianni Mariani added the comment: Excellent. Thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue44674] dataclasses should allow frozendict default value

2021-12-11 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue44674] dataclasses should allow frozendict default value

2021-12-11 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset e029c53e1a408b89a4e3edf30a9b38b094f9c880 by Eric V. Smith in branch 'main': bpo-44674: Use unhashability as a proxy for mutability for default dataclass __init__ arguments. (GH-29867) https://github.com/python/cpython/commit/e029c53e1a408b89a4e3

[issue44674] dataclasses should allow frozendict default value

2021-11-30 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +28093 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29867 ___ Python tracker ___ __

[issue44674] dataclasses should allow frozendict default value

2021-10-03 Thread Eric V. Smith
Change by Eric V. Smith : -- type: compile error -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44674] dataclasses should allow frozendict default value

2021-10-03 Thread Eric V. Smith
Eric V. Smith added the comment: That's a good idea, Raymond. >>> [x.__hash__ is None for x in (list, dict, set, frozenset)] [True, True, True, False] I don't think this change would cause any backward compatibility issues, except it would now allow a default of something bad like: >>> clas

[issue44674] dataclasses should allow frozendict default value

2021-10-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Eric] > I agree that there's no good way of telling if an > arbitrary class is immutable, so I'm not sure we can > do anything here. Consider using non-hashability as a proxy indicator for immutability. - isinstance(f.default, (list, dict, set))

[issue44674] dataclasses should allow frozendict default value

2021-07-23 Thread Gianni Mariani
Gianni Mariani added the comment: @Arjun - this is about default values (See the bug description - Using a frozendict as a default value) Try this: from frozendict import frozendict from dataclasses import dataclass @dataclass class A: a: frozendict = frozendict(a=1) This used to work

[issue44674] dataclasses should allow frozendict default value

2021-07-23 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue44674] dataclasses should allow frozendict default value

2021-07-23 Thread Eric V. Smith
Eric V. Smith added the comment: When I originally read this, I read it as frozenset. I agree that there's no good way of telling if an arbitrary class is immutable, so I'm not sure we can do anything here. So I think we should close this as a rejected idea. --

[issue44674] dataclasses should allow frozendict default value

2021-07-23 Thread Arjun
Arjun added the comment: Which frozendict does your message concern? I found this in some test: https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/test/test_builtin.py#L741 or are you suggesting any user defined immutable object? I'm not sure indicating that

[issue44674] dataclasses should allow frozendict default value

2021-07-19 Thread Eric V. Smith
Eric V. Smith added the comment: I agree that would be an improvement. -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-

[issue44674] dataclasses should allow frozendict default value

2021-07-19 Thread Gianni Mariani
New submission from Gianni Mariani : Using a frozendict as a default value should not cause an error in dataclasses. The check for mutability is: isinstance(f.default, (list, dict, set)) It appears frozendict has been changed to have a dict base class and it now raises an exception. Ther