Skip to content

Commit b2752a9

Browse files
committed
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 python/cpython#88970 for details
1 parent 863c456 commit b2752a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/zino/trapd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from dataclasses import dataclass, field
55
from ipaddress import ip_address
6-
from typing import Any, List, NamedTuple, Optional, Protocol, Set
6+
from typing import Any, List, NamedTuple, Optional, Set
77

88
from pysnmp.carrier.asyncio.dgram import udp
99
from pysnmp.entity import config
@@ -54,7 +54,7 @@ def __str__(self):
5454
return f"<Trap from {self.agent.device.name}: {variables}>"
5555

5656

57-
class TrapObserver(Protocol):
57+
class TrapObserver:
5858
"""Defines a valid protocol for SNMP trap observers.
5959
6060
A trap observer that directly subclasses this protocol can expect to be automatically registered by Zino as an

0 commit comments

Comments
 (0)