code: def test_from_param_result_refcount(self):
      # Issue #99952
      class X(Structure):
          """This struct size is <= sizeof(void*)."""
  
          _fields_ = [("a", c_void_p)]
  
          def __del__(self):
              trace.append(4)
  
          @classmethod
          def from_param(cls, value):
              trace.append(2)
              return cls()
  
      PyList_Append = PyDLL(
          _ctypes_test.__file__
      )._testfunc_pylist_append
      PyList_Append.restype = c_int
      PyList_Append.argtypes = [py_object, py_object, X]
  
      trace = []
      trace.append(1)
      PyList_Append(trace, 3, "dummy")
      trace.append(5)
  
      self.assertEqual(trace, [1, 2, 3, 4, 5])
  
      class Y(Structure):
          """This struct size is > sizeof(void*)."""
  
          _fields_ = [("a", c_void_p), ("b", c_void_p)]
  
          def __del__(self):
              trace.append(4)
  
          @classmethod
          def from_param(cls, value):
              trace.append(2)
              return cls()
  
      PyList_Append = PyDLL(
          _ctypes_test.__file__
      )._testfunc_pylist_append
      PyList_Append.restype = c_int
      PyList_Append.argtypes = [py_object, py_object, Y]
  
      trace = []
      trace.append(1)
      PyList_Append(trace, 3, "dummy")
      trace.append(5)
  
      self.assertEqual(trace, [1, 2, 3, 4, 5])
  
imports: import _ctypes_test
  import unittest
  import test.support
  from ctypes import CDLL, PyDLL, ArgumentError, Structure, Array, Union, _Pointer, _SimpleCData, _CFuncPtr, POINTER, pointer, byref, c_void_p, c_char_p, c_wchar_p, py_object, c_bool, c_char, c_wchar, c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong, c_float, c_double, c_longdouble
label_desc: Use image node_id 17 for calling the SimpleTypesTestCase obj's underlying member method code with example usage: obj.test_from_param_result_refcount() and returns: cls, cls