[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-10 Thread Kyle Stanley
Kyle Stanley added the comment: > Should I set status for this issue for closed with resolution rejected ? I'll proceed with closing the issue. > Should I delete branch on my forked git repo ? > Can I delete my forked git repo ? Might as well delete the branch, but the forked repo might be

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-10 Thread tomaszdrozdz
tomaszdrozdz added the comment: I just wanted to call def main(): asyncio.run(...) But I can go with Your aproach. Thanks for discusion. Should I set status for this issue for closed with resolution rejected ? Should I delete branch on my forked git repo ? Can I delete

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-09 Thread Yury Selivanov
Yury Selivanov added the comment: > So how about maybe: That wouldn't work. You still haven't explained what's wrong with calling `loop = asyncio.get_running_loop()` inside `async def main()`. That literally solves all problems without the need of us modifying any APIs. --

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-09 Thread tomaszdrozdz
tomaszdrozdz added the comment: OK. I understand. So how about maybe: def run(main, *, debug=False, loop=None): ... if loop: loop = events.new_event_loop() So we could customize loop like: loop = events.new_event_loop()

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-08 Thread Kyle Stanley
Kyle Stanley added the comment: Yep, having to set a custom exception handler definitely constitutes as needing "finer control over the event loop behavior". There's absolute nothing wrong with using the low-level API when you need further customization, but we try to minimize the

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-07 Thread Andrew Svetlov
Andrew Svetlov added the comment: I agree with Yuri. Usually, you don't need overriding of the default exception handler. Indeed, if you really need this low-level API I see nothing wrong with `asyncio.get_running_loop()` call. -- ___ Python

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-07 Thread tomaszdrozdz
tomaszdrozdz added the comment: https://docs.python.org/3/library/asyncio-eventloop.html#error-handling-api Here we can read: Application developers should typically use the high-level asyncio functions, such as asyncio.run(), and should rarely need to reference the loop object or call

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-06 Thread Yury Selivanov
Yury Selivanov added the comment: The idiomatic way: async def main(): loop = asyncio.get_running_loop() loop.set_exception_handler(...) # other code asyncio.run(main()) We don't want to add new arguments to asyncio.run as there would be too many. --

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-03 Thread tomaszdrozdz
Change by tomaszdrozdz : -- keywords: +patch pull_requests: +20444 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21295 ___ Python tracker ___

[issue41202] Allow to provide custom exception handler to asyncio.run()

2020-07-03 Thread tomaszdrozdz
Change by tomaszdrozdz : -- title: Allo to provide custom exception handler to asyncio.run() -> Allow to provide custom exception handler to asyncio.run() ___ Python tracker