code: def test_entry_frames_are_invisible_during_teardown(self):
      class C:
          """A weakref'able class."""
  
      def f():
          """Try to find globals and locals as this frame is being cleared."""
          ref = C()
          # Ignore the fact that exec(C()) is a nonsense callback. We're only
          # using exec here because it tries to access the current frame's
          # globals and locals. If it's trying to get those from a shim frame,
          # we'll crash before raising:
          return weakref.ref(ref, exec)
  
      with support.catch_unraisable_exception() as catcher:
          # Call from C, so there is a shim frame directly above f:
          weak = operator.call(f)  # BOOM!
          # Cool, we didn't crash. Check that the callback actually happened:
          self.assertIs(catcher.unraisable.exc_type, TypeError)
      self.assertIsNone(weak())
  
imports: import gc
  import operator
  import re
  import sys
  import textwrap
  import threading
  import types
  import unittest
  import weakref
  from test import support
  from test.support import threading_helper
  from test.support.script_helper import assert_python_ok
label_desc: Use image node_id 4 for calling the TestIncompleteFrameAreInvisible obj's underlying member method code with example usage: obj.test_entry_frames_are_invisible_during_teardown() and returns: weakref