Skip to content

Commit

Permalink
Remove enter and exit from async context managers (#9313)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell authored Jan 8, 2020
1 parent 52c1214 commit 61c1fac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 6 additions & 1 deletion sdk/core/azure-core/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
- Support fixed retry #6419
- Support "retry-after-ms" in response header #9240

## 1.1.1 (2019-12-03)
### Bug fixes

- Removed `__enter__` and `__exit__` from async context managers
([#9313](https://github.com/Azure/azure-sdk-for-python/pull/9313))

## 1.1.1 (2019-12-03)

### Bug fixes

Expand Down
7 changes: 0 additions & 7 deletions sdk/core/azure-core/azure/core/pipeline/_base_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ def __init__(self, transport, policies: AsyncPoliciesType = None) -> None:
if self._impl_policies:
self._impl_policies[-1].next = _AsyncTransportRunner(self._transport)

def __enter__(self):
raise TypeError("Use 'async with' instead")

def __exit__(self, exc_type, exc_val, exc_tb):
# __exit__ should exist in pair with __enter__ but never executed
pass # pragma: no cover

async def __aenter__(self) -> "AsyncPipeline":
await self._transport.__aenter__()
return self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,3 @@ async def close(self):

async def sleep(self, duration):
await asyncio.sleep(duration)

def __enter__(self):
raise TypeError("Use async with instead")

def __exit__(self, exc_type, exc_val, exc_tb):
# __exit__ should exist in pair with __enter__ but never executed
pass # pragma: no cover

0 comments on commit 61c1fac

Please sign in to comment.