From 0f2f89e1dc94bf13396fb0c77fc6fabbb5bfd6b9 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Tue, 10 Oct 2023 08:46:52 -0700 Subject: [PATCH] Revert "enter session only when it is not none. (#32359)" (#32391) This reverts commit b8dec12bcf9723a40845db0bc5984fa266bee82f. --- sdk/core/azure-core/CHANGELOG.md | 2 -- sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 100dcc7d2f13..3da8217bdc40 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -8,8 +8,6 @@ ### Bugs Fixed -- Added check that enter aiohttp session only when it is not None. - ### Other Changes ## 1.29.4 (2023-09-07) diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py b/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py index fad9905132e2..9c525533211a 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py @@ -124,8 +124,7 @@ 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) - if self.session is not None: - await self.session.__aenter__() + await self.session.__aenter__() async def close(self): """Closes the connection."""