I think this should have been a comment, but i have no reputation so i can't comment.
I'm seeing the exact same issue as the OP, running python 3.12, and pysnmp 7.1.15.
One possible workaround is to wrap the snmp command in asyncio.wait_for().
task = asyncio.create_task(
bulk_cmd(
snmpDispatcher,
CommunityData("public"),
await UdpTransportTarget.create(("127.0.0.1", 161), timeout=0.3),
0,
20,
*varBinds,
)
)
try:
await asyncio.wait_for(task, timeout=10)
except TimeoutError:
print("Timeout")
errorIndication, errorStatus, errorIndex, varBindTable = task.result()
This is absolutely an ugly hack.