[New-bugs-announce] [issue42466] asyncio loop.getaddrinfo raises RuntimeError
Giacomo Caironi
report at bugs.python.org
Wed Nov 25 11:57:54 EST 2020
New submission from Giacomo Caironi <giacomo.caironi at gmail.com>:
import asyncio
import traceback
from threading import Thread
class Test(Thread):
def __init__(self):
super().__init__()
self.loop = asyncio.new_event_loop()
async def getaddrinfo(self, loop):
try:
print(await loop.getaddrinfo("www.google.com", 8333))
except Exception:
print(traceback.format_exc())
def run(self):
loop = self.loop
asyncio.set_event_loop(loop)
asyncio.run_coroutine_threadsafe(self.getaddrinfo(loop), loop)
loop.run_forever()
test = Test()
test.start()
Executing the previous code throws RuntimeError("can't register atexit after shutdown") only in python3.9. Strangely it doesn't happen when I execute the code in interactive mode.
I think this is related to https://bugs.python.org/issue41962
----------
components: asyncio
messages: 381850
nosy: asvetlov, kappa, yselivanov
priority: normal
severity: normal
status: open
title: asyncio loop.getaddrinfo raises RuntimeError
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42466>
_______________________________________
More information about the New-bugs-announce
mailing list