MCPcopy
hub / github.com/tornadoweb/tornado / _clear_callbacks

Method _clear_callbacks

tornado/http1connection.py:312–322  ·  view source on GitHub ↗

Clears the callback attributes. This allows the request handler to be garbage collected more quickly in CPython by breaking up reference cycles.

(self)

Source from the content-addressed store, hash-verified

310 return True
311
312 def _clear_callbacks(self) -> None:
313 """Clears the callback attributes.
314
315 This allows the request handler to be garbage collected more
316 quickly in CPython by breaking up reference cycles.
317 """
318 self._write_callback = None
319 self._write_future = None # type: Optional[Future[None]]
320 self._close_callback = None # type: Optional[Callable[[], None]]
321 if self.stream is not None:
322 self.stream.set_close_callback(None)
323
324 def set_close_callback(self, callback: Optional[Callable[[], None]]) -> None:
325 """Sets a callback that will be run when the connection is closed.

Callers 6

__init__Method · 0.95
_read_messageMethod · 0.95
_on_connection_closeMethod · 0.95
closeMethod · 0.95
detachMethod · 0.95
_finish_requestMethod · 0.95

Calls 1

set_close_callbackMethod · 0.45

Tested by

no test coverage detected