code: def test_p2a_objects(self):
      array = (c_char_p * 5)()
      self.assertEqual(array._objects, None)
      array[0] = b"foo bar"
      self.assertEqual(array._objects, {"0": b"foo bar"})
  
      p = cast(array, POINTER(c_char_p))
      # array and p share a common _objects attribute
      self.assertIs(p._objects, array._objects)
      self.assertEqual(
          array._objects, {"0": b"foo bar", id(array): array}
      )
      p[0] = b"spam spam"
      self.assertEqual(
          p._objects, {"0": b"spam spam", id(array): array}
      )
      self.assertIs(array._objects, p._objects)
      p[1] = b"foo bar"
      self.assertEqual(
          p._objects,
          {"1": b"foo bar", "0": b"spam spam", id(array): array},
      )
      self.assertIs(array._objects, p._objects)
  
file_path: cpython/Lib/test/test_ctypes/test_cast.py
imports: import sys
  import unittest
  from ctypes import Structure, Union, POINTER, cast, sizeof, addressof, c_void_p, c_char_p, c_wchar_p, c_byte, c_short, c_int
label_desc: Use image node_id 3 for calling the Test obj's underlying member method code with example usage: obj.test_p2a_objects() without return types