Skip to content

Commit

Permalink
enter session only when it is not none. (#32359)
Browse files Browse the repository at this point in the history
* enter session only when it is not none.

* update
  • Loading branch information
xiangyan99 authored Oct 6, 2023
1 parent d2f6a0e commit b8dec12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Added check that enter aiohttp session only when it is not None.

### Other Changes

## 1.29.4 (2023-09-07)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ async def open(self):
self.session = aiohttp.ClientSession(**clientsession_kwargs)
# pyright has trouble to understand that self.session is not None, since we raised at worst in the init
self.session = cast(aiohttp.ClientSession, self.session)
await self.session.__aenter__()
if self.session is not None:
await self.session.__aenter__()

async def close(self):
"""Closes the connection."""
Expand Down

0 comments on commit b8dec12

Please sign in to comment.