class_docstr: This test only works when python itself is a dll/shared library
class_docstr_tok: ["This","test","only","works","when","python","itself","is","a","dll\/shared","library"]
code: def test_frozentable(self):
      # Python exports a PyImport_FrozenModules symbol. This is a
      # pointer to an array of struct _frozen entries.  The end of the
      # array is marked by an entry containing a NULL name and zero
      # size.
  
      # In standard Python, this table contains a __hello__
      # module, and a __phello__ package containing a spam
      # module.
      class struct_frozen(Structure):
          _fields_ = [
              ("name", c_char_p),
              ("code", POINTER(c_ubyte)),
              ("size", c_int),
          ]
  
      FrozenTable = POINTER(struct_frozen)
  
      ft = FrozenTable.in_dll(pythonapi, "PyImport_FrozenModules")
      # ft is a pointer to the struct_frozen entries:
      items = []
      for entry in ft:
          # This is dangerous. We *can* iterate over a pointer, but
          # the loop will not terminate (maybe with an access
          # violation;-) because the pointer instance has no size.
          if entry.name is None:
              break
          items.append((entry.name, entry.size))
  
      expected = [
          ("__hello__", 104),
          ("__phello__", -104),
          ("__phello__.spam", 104),
      ]
      self.assertEqual(items, expected)
  
      from ctypes import _pointer_type_cache
  
      del _pointer_type_cache[struct_frozen]
  
file_path: catboost/contrib/tools/python/src/Lib/ctypes/test/test_values.py
imports: import unittest
  import sys
  from ctypes import *
  import _ctypes_test
label_desc: Use image node_id 2 for calling the PythonValuesTestCase obj's underlying member method code with example usage: obj.test_frozentable() without return types