[issue28777] Add asyncio.Queue __aiter__, __anext__ methods
Georgy added the comment: I successfully use my code: import asyncio, sanic class MyQueue(asyncio.Queue): def __aiter__(self): return self async def __anext__(self): return await self.get() app = sanic.Sanic() ws_set = set() app.static('/', 'async.html') @app.websocket('/ws') async def root_ws(request, ws): ws_set.add(ws) try: while True: await ws.recv() finally: ws_set.remove(ws) async def postgres(): import aiopg async with aiopg.create_pool('') as pool: async with pool.acquire() as connection: connection._notifies = MyQueue() async with connection.cursor() as cursor: await cursor.execute('LISTEN message') async for message in connection.notifies: for ws in ws_set: await ws.send(message.payload) try: asyncio.get_event_loop().run_until_complete(asyncio.gather(app.create_server(), postgres())) except KeyboardInterrupt: asyncio.get_event_loop().stop() -- ___ Python tracker <http://bugs.python.org/issue28777> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28777] asinc iter queue
New submission from Georgy: adding to asyncio.Queue class following methods: def __aiter__(self): return self async def __anext__(self): return await self.get() let use asyncio.Queue follow: queue = asyncio.Queue() ... async for item in queue: do_something_with(item) -- components: asyncio messages: 281536 nosy: RekGRpth, gvanrossum, yselivanov priority: normal severity: normal status: open title: asinc iter queue type: enhancement versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue28777> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40037] py_compile.py quiet undefined in main function
Georgy Kibardin added the comment: Please, reopen. -- ___ Python tracker <https://bugs.python.org/issue40037> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40037] py_compile.py quiet undefined in main function
Georgy Kibardin added the comment: This is not a duplicate of https://bugs.python.org/issue38731. quiet is is still undefined in main() -- nosy: +Georgy Kibardin ___ Python tracker <https://bugs.python.org/issue40037> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40037] py_compile.py quiet undefined in main function
Georgy Kibardin added the comment: https://bugs.python.org/issue39743 is closed as duplicate of https://bugs.python.org/issue38731. https://bugs.python.org/issue38731 fixes undeclared variable "quiet" in function compile(). At the same time variable "quiet" is used in function main() where it is still undeclared and 38731 doesn't fix this problem - it is still there, in python 3.8.2. -- ___ Python tracker <https://bugs.python.org/issue40037> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com