[issue41197] Async magic methods in contextlib.closing

2021-10-04 Thread Nathaniel Smith
Change by Nathaniel Smith : -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue41197] Async magic methods in contextlib.closing

2020-08-10 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: +asvetlov, njs ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41197] Async magic methods in contextlib.closing

2020-08-10 Thread Yury Selivanov
Yury Selivanov added the comment: I'm OK with adding this, but the close method should be `aclose()` -- ___ Python tracker ___ ___

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Warning is not error. It may left unnoticed, especially if the code is executed on server. And in this particular case turning the warning into exception by setting warning filters does not help, because it would be raised in the context where exceptions

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This seems to be a duplicate of issue40213 with a link to implementation in trio. -- nosy: +xtreak ___ Python tracker ___

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Ramzan Bekbulatov
Ramzan Bekbulatov added the comment: In this case: ```python3 class A: async def close(self): pass with closing(A()): pass ``` Python will raise `RuntimeWarning: coroutine 'A.close' was never awaited`. In another case: ```python3 class B: def close(self):

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And what happen when you accidentally use synchronous "with" instead of "async with" with closing()? with closing(SomeAPI()) as api: ... I think it is intentionally that different functions/methods/classes are used for synchronous and asynchronous

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41197] Async magic methods in contextlib.closing

2020-07-02 Thread Рамзан Б .
New submission from Рамзан Б. : # Async magic methods in contextlib.closing I think `__aenter__` and `__aexit__` methods should be added to `contextlib.closing`, so that we can use `contextlib.closing` in async code too. For example: ```python3 class SomeAPI: ... async def