class_docstr: Context manager catching threading.Thread exception using
  threading.excepthook.
  
  Storing exc_value using a custom hook can create a reference cycle. The
  reference cycle is broken explicitly when the context manager exits.
  
  Storing thread using a custom hook can resurrect it if it is set to an
  object which is being finalized. Exiting the context manager clears the
  stored object.
  
  Usage:
      with threading_helper.catch_threading_exception() as cm:
          # code spawning a thread which raises an exception
          ...
          # check the thread exception: use cm.args
          ...
      # cm.args attribute no longer exists at this point
      # (to break a reference cycle)
class_docstr_tok: ["Context","manager","catching","threading.Thread","exception","using","threading.excepthook",".","Storing","exc_value","using","a","custom","hook","can","create","a","reference","cycle",".","The","reference","cycle","is","broken","explicitly","when","the","context","manager","exits",".","Storing","thread","using","a","custom","hook","can","resurrect","it","if","it","is","set","to","an","object","which","is","being","finalized",".","Exiting","the","context","manager","clears","the","stored","object",".","Usage",":","with","threading_helper.catch_threading_exception","(",")","as","cm",":","#","code","spawning","a","thread","which","raises","an","exception","...","#","check","the","thread","exception",":","use","cm.args","...","#","cm.args","attribute","no","longer","exists","at","this","point","#","(","to","break","a","reference","cycle",")"]
code: def __init__(self) -> None:
      self.args: Optional["threading.ExceptHookArgs"] = None
      self._old_hook: Optional[
          Callable[["threading.ExceptHookArgs"], Any]
      ] = None
  
file_path: catboost/contrib/python/pytest/py3/_pytest/threadexception.py
imports: import threading
  import traceback
  import warnings
  from types import TracebackType
  from typing import Any
  from typing import Callable
  from typing import Generator
  from typing import Optional
  from typing import Type
  import pytest
label_desc: Use image node_id 1 to create a new catch_threading_exception object  with example: obj = catch_threading_exception()