cleanup aiopg.pool.Pool.cursor method
- Langage dominant
- Python
- Étoiles
- 1.4k
- Forks
- 170
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
right now using this method is not async with nice, with the syntax:
```python
with (yield from pool.cursor()) as cur:
yield from cur.execute("SELECT 1")
```
Based on the usage of context managers in aiopg, it should instead behavior like aiopg.create_pool, to yield the following usage:
```python
async with pool.cursor() as cur:
yield from cur.execute("SELECT 1")
```
In order to accomplish this aiopg.pool.Pool.cursor should not be marked a coroutine, and the acquisition of the connection and cursor should not happen until `__aenter__` of _PoolCursorContextManager. With the current design probably the easiest way would be to pass a coroutine closure to _PoolCursorContextManager to return the conn and cur during `__aenter__`
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.