File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,7 @@ class Client(SyncMethodMixin):
764
764
765
765
preloads : list [preloading .Preload ]
766
766
__loop : IOLoop | None = None
767
+ __aentering = False
767
768
768
769
def __init__ (
769
770
self ,
@@ -1133,6 +1134,12 @@ def start(self, **kwargs):
1133
1134
sync (self .loop , self ._start , ** kwargs )
1134
1135
1135
1136
def __await__ (self ):
1137
+ if not self .__aentering :
1138
+ warnings .warn (
1139
+ "await Client() is deprecated, use async with Client():" ,
1140
+ DeprecationWarning ,
1141
+ stacklevel = 2 ,
1142
+ )
1136
1143
if hasattr (self , "_started" ):
1137
1144
return self ._started .__await__ ()
1138
1145
else :
@@ -1379,7 +1386,11 @@ def __enter__(self):
1379
1386
return self
1380
1387
1381
1388
async def __aenter__ (self ):
1382
- await self
1389
+ self .__aentering = True
1390
+ try :
1391
+ await self
1392
+ finally :
1393
+ self .__aentering = False
1383
1394
return self
1384
1395
1385
1396
async def __aexit__ (self , exc_type , exc_value , traceback ):
You can’t perform that action at this time.
0 commit comments