[issue39247] dataclass defaults and property don't work together
Ivan Ivanyuk added the comment: Was there some solution in progress here? We would like to use dataclasses and seems this problem currently limits their usefulness to us. We recently came upon the same behaviour https://mail.python.org/pipermail/python-list/2020-June/897502.html and I was wondering if it was possible to make it work without changing the property decorator behaviour. Is there a way at all to preserve the default value on the class with @property even before dataclass starts processing it? An example from that mail thread to workaround this: from dataclasses import dataclass, field def set_property(): Container.x = property(Container.get_x, Container.set_x) return 30 @dataclass class Container: x: int = field(default_factory=set_property) def get_x(self) -> int: return self._x def set_x(self, z: int): if z > 1: self._x = z else: raise ValueError set_property can also be made a class method and referenced like this: x: int = field(default_factory=lambda: Container.set_property()) Is it possible that this kind of behaviour can be made one of standard flows for the field() function and dataclasses module can generate a function like this and set it on the class during processing? Or maybe it's better to extend @property decorator to update property object with default value which can be used later by the dataclass? -- nosy: +iivanyuk ___ Python tracker <https://bugs.python.org/issue39247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40227] SSLError is not passed to the client during handshake
New submission from Ivan Ivanyuk : Due to the combination of the logic here: https://github.com/python/cpython/blob/master/Lib/asyncio/sslproto.py#L483 and changes introduced in the issue https://bugs.python.org/issue37035, the assumption that "Not-logged exceptions are not skipped but reported to the user by protocol.connection_lost(exc) callback." as stated in the issue is not valid. If SSLError happens during the handshake, no exception get's propagated even if it's possible to log stacktrace using loop.set_debug(True). As opposed to the usage pattern mentioned in the initial issue comment, we are very much interested in the errors there, so, for now, I just monkey patch SSLprotocol.connection_lost() in runtime to be like this https://github.com/anthrax-0/cpython/pull/1/commits/d652ed8d0e72bb839fe4841530cc48928b3c3bb0 . What should be the best solution for this? -- components: asyncio messages: 365988 nosy: asvetlov, iivanyuk, yselivanov priority: normal severity: normal status: open title: SSLError is not passed to the client during handshake type: behavior versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue40227> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com