@@ -1133,9 +1133,9 @@ def connection_lost(self, exc):
11331133 stream = self ._stream
11341134 if stream is not None :
11351135 if exc is None :
1136- stream .feed_eof ()
1136+ stream ._feed_eof ()
11371137 else :
1138- stream .set_exception (exc )
1138+ stream ._set_exception (exc )
11391139 if not self ._closed .done ():
11401140 if exc is None :
11411141 self ._closed .set_result (None )
@@ -1147,12 +1147,12 @@ def connection_lost(self, exc):
11471147 def data_received (self , data ):
11481148 stream = self ._stream
11491149 if stream is not None :
1150- stream .feed_data (data )
1150+ stream ._feed_data (data )
11511151
11521152 def eof_received (self ):
11531153 stream = self ._stream
11541154 if stream is not None :
1155- stream .feed_eof ()
1155+ stream ._feed_eof ()
11561156 if self ._over_ssl :
11571157 # Prevent a warning in SSLProtocol.eof_received:
11581158 # "returning true from eof_received()
@@ -1219,7 +1219,7 @@ def connection_made(self, transport):
12191219 stream = self ._stream
12201220 if stream is None :
12211221 return
1222- stream .set_transport (transport )
1222+ stream ._set_transport (transport )
12231223 stream ._protocol = self
12241224
12251225 def connection_lost (self , exc ):
@@ -1351,6 +1351,11 @@ def is_server_side(self):
13511351
13521352 @property
13531353 def transport (self ):
1354+ warnings .warn ("Stream.transport attribute is deprecated "
1355+ "since Python 3.8 and is scheduled for removal in 3.10; "
1356+ "it is an internal API" ,
1357+ DeprecationWarning ,
1358+ stacklevel = 2 )
13541359 return self ._transport
13551360
13561361 def write (self , data ):
@@ -1366,7 +1371,7 @@ def writelines(self, data):
13661371 def _fast_drain (self ):
13671372 # The helper tries to use fast-path to return already existing
13681373 # complete future object if underlying transport is not paused
1369- #and actual waiting for writing resume is not needed
1374+ # and actual waiting for writing resume is not needed
13701375 exc = self .exception ()
13711376 if exc is not None :
13721377 fut = self ._loop .create_future ()
@@ -1450,6 +1455,14 @@ def exception(self):
14501455 return self ._exception
14511456
14521457 def set_exception (self , exc ):
1458+ warnings .warn ("Stream.set_exception() is deprecated "
1459+ "since Python 3.8 and is scheduled for removal in 3.10; "
1460+ "it is an internal API" ,
1461+ DeprecationWarning ,
1462+ stacklevel = 2 )
1463+ self ._set_exception (exc )
1464+
1465+ def _set_exception (self , exc ):
14531466 self ._exception = exc
14541467
14551468 waiter = self ._waiter
@@ -1467,6 +1480,14 @@ def _wakeup_waiter(self):
14671480 waiter .set_result (None )
14681481
14691482 def set_transport (self , transport ):
1483+ warnings .warn ("Stream.set_transport() is deprecated "
1484+ "since Python 3.8 and is scheduled for removal in 3.10; "
1485+ "it is an internal API" ,
1486+ DeprecationWarning ,
1487+ stacklevel = 2 )
1488+ self ._set_transport (transport )
1489+
1490+ def _set_transport (self , transport ):
14701491 if transport is self ._transport :
14711492 return
14721493 assert self ._transport is None , 'Transport already set'
@@ -1478,6 +1499,14 @@ def _maybe_resume_transport(self):
14781499 self ._transport .resume_reading ()
14791500
14801501 def feed_eof (self ):
1502+ warnings .warn ("Stream.feed_eof() is deprecated "
1503+ "since Python 3.8 and is scheduled for removal in 3.10; "
1504+ "it is an internal API" ,
1505+ DeprecationWarning ,
1506+ stacklevel = 2 )
1507+ self ._feed_eof ()
1508+
1509+ def _feed_eof (self ):
14811510 self ._eof = True
14821511 self ._wakeup_waiter ()
14831512
@@ -1486,6 +1515,14 @@ def at_eof(self):
14861515 return self ._eof and not self ._buffer
14871516
14881517 def feed_data (self , data ):
1518+ warnings .warn ("Stream.feed_data() is deprecated "
1519+ "since Python 3.8 and is scheduled for removal in 3.10; "
1520+ "it is an internal API" ,
1521+ DeprecationWarning ,
1522+ stacklevel = 2 )
1523+ self ._feed_data (data )
1524+
1525+ def _feed_data (self , data ):
14891526 _ensure_can_read (self ._mode )
14901527 assert not self ._eof , 'feed_data after feed_eof'
14911528
0 commit comments