aio-libs / aio-libs/aiohttp

Proposal: rename `async def close()` to `async def aclose()` across aiohttp

未关闭
#12,922 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
16.5k
派生
2.4k
平均合并
17 小时 22 分钟
30 天内合并 PR
212

描述

### Describe the solution you'd like

`contextlib.aclosing()` expects the object to provide an `aclose()` coroutine, which it awaits automatically. This makes `aclose` the de-facto naming convention for asynchronous close methods.
For consistency with this convention, I propose renaming `async def close()` to `async def aclose()` on all aiohttp classes that currently expose an async `close()`. Backward compatibility should be preserved: the old `close()` should keep working but emit a `DeprecationWarning` when called.

### Related component

Server and Client

### Code of Conduct

- [x] I agree to follow the aio-libs Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。