HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //snap/core18/current/usr/lib/python3/dist-packages/asn1crypto/_ffi.py
# coding: utf-8

"""
FFI helper compatibility functions. Exports the following items:

 - LibraryNotFoundError
 - FFIEngineError
 - bytes_from_buffer()
 - buffer_from_bytes()
 - null()
"""

from __future__ import unicode_literals, division, absolute_import, print_function

from ctypes import create_string_buffer


def buffer_from_bytes(initializer):
    return create_string_buffer(initializer)


def bytes_from_buffer(buffer, maxlen=None):
    return buffer.raw


def null():
    return None


class LibraryNotFoundError(Exception):

    """
    An exception when trying to find a shared library
    """

    pass


class FFIEngineError(Exception):

    """
    An exception when trying to instantiate ctypes or cffi
    """

    pass