From 587c52221f797bd4c3b6261f25459a21672727c7 Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Mon, 27 May 2024 14:27:27 +0200 Subject: [PATCH] Don't define TrapObserver as Protocol The changed implementation relies on inheritance of `__init__`, making this no longer a clean "Protocol", but a base class. While this is apparently supported in Python 3.11, Python versions earlier than 3.11 would override the inherited `__init__` method, thereby breaking this implementation. See https://github.com/python/cpython/issues/88970 for details --- src/zino/trapd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zino/trapd.py b/src/zino/trapd.py index e53afea2d..b07b0893b 100644 --- a/src/zino/trapd.py +++ b/src/zino/trapd.py @@ -3,7 +3,7 @@ import logging from dataclasses import dataclass, field from ipaddress import ip_address -from typing import Any, List, NamedTuple, Optional, Protocol, Set +from typing import Any, List, NamedTuple, Optional, Set from pysnmp.carrier.asyncio.dgram import udp from pysnmp.entity import config @@ -54,7 +54,7 @@ def __str__(self): return f"" -class TrapObserver(Protocol): +class TrapObserver: """Defines a valid protocol for SNMP trap observers. A trap observer that directly subclasses this protocol can expect to be automatically registered by Zino as an