바이트열 객체
*************

이 함수들은 바이트열 매개 변수가 필요할 때 바이트열이 아닌 매개 변수로
호출하면 "TypeError"를 발생시킵니다.

PyBytesObject

   이 "PyObject"의 서브 형은 파이썬 바이트열 객체를 나타냅니다.

PyTypeObject PyBytes_Type

   이 "PyTypeObject"의 인스턴스는 파이썬 바이트열 형을 나타냅니다; 파
   이썬 계층의 "bytes"와 같은 객체입니다.

int PyBytes_Check(PyObject *o)

   객체 *o*가 바이트열 객체이거나 바이트열 형의 서브 형의 인스턴스면
   참을 반환합니다.

int PyBytes_CheckExact(PyObject *o)

   객체 *o*가 바이트열 객체이지만, 바이트열 형의 서브 형의 인스턴스는
   아니면 참을 반환합니다.

PyObject* PyBytes_FromString(const char *v)
    *Return value: New reference.*

   Return a new bytes object with a copy of the string *v* as value on
   success, and "NULL" on failure.  The parameter *v* must not be
   "NULL"; it will not be checked.

PyObject* PyBytes_FromStringAndSize(const char *v, Py_ssize_t len)
    *Return value: New reference.*

   Return a new bytes object with a copy of the string *v* as value
   and length *len* on success, and "NULL" on failure.  If *v* is
   "NULL", the contents of the bytes object are uninitialized.

PyObject* PyBytes_FromFormat(const char *format, ...)
    *Return value: New reference.*

   C "printf()"-스타일 *format* 문자열과 가변 개수의 인자를 받아서, 결
   과 파이썬 바이트열 객체의 크기를 계산하고 그 안에 값이 포맷된 바이
   트열 객체를 반환합니다. 가변 인자는 C 형이어야 하며 *format* 문자열
   에 있는 포맷 문자들과 정확히 대응해야 합니다. 허용되는 포맷 문자는
   다음과 같습니다:

   +---------------------+-----------------+----------------------------------+
   | 포맷 문자           | 형              | 주석                             |
   |=====================|=================|==================================|
   | "%%"                | *n/a*           | 리터럴 % 문자.                   |
   +---------------------+-----------------+----------------------------------+
   | "%c"                | int             | 단일 바이트, C int로 표현됩니다. |
   +---------------------+-----------------+----------------------------------+
   | "%d"                | int             | "printf("%d")"와 동등합니다. [1] |
   +---------------------+-----------------+----------------------------------+
   | "%u"                | unsigned int    | "printf("%u")"와 동등합니다. [1] |
   +---------------------+-----------------+----------------------------------+
   | "%ld"               | long            | "printf("%ld")"와 동등합니다.    |
   |                     |                 | [1]                              |
   +---------------------+-----------------+----------------------------------+
   | "%lu"               | unsigned long   | "printf("%lu")"와 동등합니다.    |
   |                     |                 | [1]                              |
   +---------------------+-----------------+----------------------------------+
   | "%zd"               | Py_ssize_t      | "printf("%zd")"와 동등합니다.    |
   |                     |                 | [1]                              |
   +---------------------+-----------------+----------------------------------+
   | "%zu"               | size_t          | "printf("%zu")"와 동등합니다.    |
   |                     |                 | [1]                              |
   +---------------------+-----------------+----------------------------------+
   | "%i"                | int             | "printf("%i")"와 동등합니다. [1] |
   +---------------------+-----------------+----------------------------------+
   | "%x"                | int             | "printf("%x")"와 동등합니다. [1] |
   +---------------------+-----------------+----------------------------------+
   | "%s"                | const char*     | 널-종료 C 문자 배열.             |
   +---------------------+-----------------+----------------------------------+
   | "%p"                | const void*     | C 포인터의 16진수 표현. 플랫폼의 |
   |                     |                 | "printf"가 어떤 결과를 내는지에  |
   |                     |                 | 상 관없이 리터럴 "0x"로 시작함이 |
   |                     |                 | 보장된다는 점을 제외하고는 거의  |
   |                     |                 | "printf("%p")"와 동등합니다.     |
   +---------------------+-----------------+----------------------------------+

   인식할 수 없는 포맷 문자는 포맷 문자열의 나머지 부분이 모두 결과 객
   체에 그대로 복사되게 만들고, 추가 인자는 무시됩니다.

   [1] 정수 지정자 (d, u, ld, lu, zd, zu, i, x)에서: 0-변환 플래그는
       정밀도를 지정해도 영향을 미칩니다.

PyObject* PyBytes_FromFormatV(const char *format, va_list vargs)
    *Return value: New reference.*

   정확히 두 개의 인자를 취한다는 것을 제외하고는
   "PyBytes_FromFormat()"과 같습니다.

PyObject* PyBytes_FromObject(PyObject *o)
    *Return value: New reference.*

   버퍼 프로토콜을 구현하는 객체 *o*의 바이트열 표현을 반환합니다.

Py_ssize_t PyBytes_Size(PyObject *o)

   바이트열 객체 *o*의 길이를 반환합니다.

Py_ssize_t PyBytes_GET_SIZE(PyObject *o)

   에러 검사 없는 "PyBytes_Size()"의 매크로 형식.

char* PyBytes_AsString(PyObject *o)

   Return a pointer to the contents of *o*.  The pointer refers to the
   internal buffer of *o*, which consists of "len(o) + 1" bytes.  The
   last byte in the buffer is always null, regardless of whether there
   are any other null bytes.  The data must not be modified in any
   way, unless the object was just created using
   "PyBytes_FromStringAndSize(NULL, size)". It must not be
   deallocated.  If *o* is not a bytes object at all,
   "PyBytes_AsString()" returns "NULL" and raises "TypeError".

char* PyBytes_AS_STRING(PyObject *string)

   에러 검사 없는 "PyBytes_AsString()"의 매크로 형식.

int PyBytes_AsStringAndSize(PyObject *obj, char **buffer, Py_ssize_t *length)

   출력 변수 *buffer*와 *length*로 객체 *obj*의 널-종료 내용을 반환합
   니다.

   If *length* is "NULL", the bytes object may not contain embedded
   null bytes; if it does, the function returns "-1" and a
   "ValueError" is raised.

   buffer는 *obj*의 내부 버퍼를 가리키게 되는데, 끝에 추가 널 바이트가
   포함됩니다 (*length*에는 포함되지 않습니다). 객체가
   "PyBytes_FromStringAndSize(NULL, size)"를 사용하여 방금 만들어진 경
   우가 아니면 데이터를 수정해서는 안 됩니다. 할당을 해제해서는 안 됩
   니다. *obj*가 바이트열 객체가 아니면 "PyBytes_AsStringAndSize()"는
   "-1"을 반환하고 "TypeError"를 발생시킵니다.

   버전 3.5에서 변경: 이전에는, 바이트열 객체에 널 바이트가 포함되어
   있으면 "TypeError"가 발생했습니다.

void PyBytes_Concat(PyObject **bytes, PyObject *newpart)

   Create a new bytes object in **bytes* containing the contents of
   *newpart* appended to *bytes*; the caller will own the new
   reference.  The reference to the old value of *bytes* will be
   stolen.  If the new object cannot be created, the old reference to
   *bytes* will still be discarded and the value of **bytes* will be
   set to "NULL"; the appropriate exception will be set.

void PyBytes_ConcatAndDel(PyObject **bytes, PyObject *newpart)

   *bytes*에 *newpart*의 내용을 덧붙인 새 바이트열 객체를 **bytes*에
   만듭니다. 이 버전은 *newpart*의 참조 횟수를 감소시킵니다.

int _PyBytes_Resize(PyObject **bytes, Py_ssize_t newsize)

   A way to resize a bytes object even though it is "immutable". Only
   use this to build up a brand new bytes object; don't use this if
   the bytes may already be known in other parts of the code.  It is
   an error to call this function if the refcount on the input bytes
   object is not one. Pass the address of an existing bytes object as
   an lvalue (it may be written into), and the new size desired.  On
   success, **bytes* holds the resized bytes object and "0" is
   returned; the address in **bytes* may differ from its input value.
   If the reallocation fails, the original bytes object at **bytes* is
   deallocated, **bytes* is set to "NULL", "MemoryError" is set, and
   "-1" is returned.
