From 83812c4766602994c779f489af19b4b1945d4762 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Wed, 14 Aug 2024 22:52:43 +0200 Subject: [PATCH] Use default_factory for relay policy field RelayPolicy is mutable, so needs to be instantiated in the dataclass by a default_factory. Fixes an error on startup with python 3.12. --- nostr/relay.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nostr/relay.py b/nostr/relay.py index 8ab88f8..bef6b78 100644 --- a/nostr/relay.py +++ b/nostr/relay.py @@ -1,6 +1,6 @@ import json import time -from dataclasses import dataclass +from dataclasses import dataclass, field from queue import Queue from threading import Lock from typing import Optional @@ -34,7 +34,7 @@ class RelayProxyConnectionConfig: class Relay: url: str message_pool: MessagePool - policy: RelayPolicy = RelayPolicy() + policy: RelayPolicy = field(default_factory=RelayPolicy) ssl_options: Optional[dict] = None proxy_config: RelayProxyConnectionConfig = None