(tp)
return stgdict
Return the given ctypes type's StgDict object. If the object's dict is not a StgDict, an error is raised.

    This function is roughly equivalent to the PyType_stgdict function in the ctypes source code. We cannot use that
    function directly, because it is not part of CPython's public C API, and thus not accessible on some systems
    (see #113).
Return the given ctypes type's StgDict object. If the object's dict is not a StgDict, an error is raised.
Return the given ctypes type s StgDict object . If the object s dict is not a StgDict an error is raised .
def get_stgdict_of_type(tp):
    """Return the given ctypes type's StgDict object. If the object's dict is not a StgDict, an error is raised.

    This function is roughly equivalent to the PyType_stgdict function in the ctypes source code. We cannot use that
    function directly, because it is not part of CPython's public C API, and thus not accessible on some systems
    (see #113).
    """

    if not isinstance(tp, type):
        raise TypeError(
            'Expected a type object, not {tptp.__module__}.{tptp.__qualname__}'
            .format(tptp=type(tp))
        )

    stgdict = tp.__dict__
    if isinstance(stgdict, types.MappingProxyType):
        # If the type's __dict__ is wrapped in a mapping proxy, we need to unwrap it.
        # (This appears to always be the case, so the isinstance check above could perhaps be left out, but it
        # doesn't hurt to check.)
        stgdict = unwrap_mappingproxy(stgdict)

    # The StgDict type is not publicly exposed anywhere, so we can't use isinstance. Checking the name is the best
    # we can do here.
    if type(stgdict).__name__ != 'StgDict':
        raise TypeError(
            "The given type's dict must be a StgDict, not {tp.__module__}.{tp.__qualname__}"
            .format(tp=type(stgdict))
        )

    return stgdict
def get_stgdict_of_type ( tp ) : if not isinstance ( tp , type ) : raise TypeError ( 'Expected a type object, not {tptp.__module__}.{tptp.__qualname__}' . format ( tptp = type ( tp ) ) ) stgdict = tp . __dict__ if isinstance ( stgdict , types . MappingProxyType ) : # If the type's __dict__ is wrapped in a mapping proxy, we need to unwrap it. # (This appears to always be the case, so the isinstance check above could perhaps be left out, but it # doesn't hurt to check.) stgdict = unwrap_mappingproxy ( stgdict ) # The StgDict type is not publicly exposed anywhere, so we can't use isinstance. Checking the name is the best # we can do here. if type ( stgdict ) . __name__ != 'StgDict' : raise TypeError ( "The given type's dict must be a StgDict, not {tp.__module__}.{tp.__qualname__}" . format ( tp = type ( stgdict ) ) ) return stgdict