숫자 프로토콜
*************

int PyNumber_Check(PyObject *o)

   객체 *o*가 숫자 프로토콜을 제공하면 "1"을 반환하고, 그렇지 않으면
   거짓을 반환합니다. 이 함수는 항상 성공합니다.

   버전 3.8에서 변경: *o*가 인덱스 정수면 "1"을 반환합니다.

PyObject* PyNumber_Add(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 더한 결과나, 실패 시 "NULL"을 반환합니다. 이것은 파이
   썬 표현식 "o1 + o2"와 동등합니다.

PyObject* PyNumber_Subtract(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*에서 *o2*를 뺀 결과나, 실패 시 "NULL"을 반환합니다. 이것은 파이
   썬 표현식 "o1 - o2"와 동등합니다.

PyObject* PyNumber_Multiply(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 곱한 결과나, 실패 시 "NULL"을 반환합니다. 이것은 파이
   썬 표현식 "o1 * o2"와 동등합니다.

PyObject* PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 행렬 곱셈한 결과나, 실패 시 "NULL"을 반환합니다. 이것
   은 파이썬 표현식 "o1 @ o2"와 동등합니다.

   버전 3.5에 추가.

PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   Return the floor of *o1* divided by *o2*, or "NULL" on failure.
   This is the equivalent of the Python expression "o1 // o2".

PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   Return a reasonable approximation for the mathematical value of
   *o1* divided by *o2*, or "NULL" on failure.  The return value is
   "approximate" because binary floating point numbers are
   approximate; it is not possible to represent all real numbers in
   base two.  This function can return a floating point value when
   passed two integers.  This is the equivalent of the Python
   expression "o1 / o2".

PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*을 *o2*로 나눈 나머지나, 실패 시 "NULL"을 반환합니다. 이것은 파
   이썬 표현식 "o1 % o2"와 동등합니다.

PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   내장 함수 "divmod()"를 참조하십시오. 실패하면 "NULL"을 반환합니다.
   이것은 파이썬 표현식 "divmod(o1, o2)"와 동등합니다.

PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3)
    *Return value: New reference.*

   내장 함수 "pow()"를 참조하십시오. 실패하면 "NULL"을 반환합니다. 이
   것은 파이썬 표현식 "pow(o1, o2, o3)"와 동등합니다, 여기서 *o3*는 선
   택적입니다. *o3*를 무시하려면, 그 자리에 "Py_None"을 전달하십시오
   (*o3*에 "NULL"을 전달하면 잘못된 메모리 액세스가 발생합니다).

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

   성공 시 *o*의 음의 값(negation)을, 실패 시 "NULL"을 반환합니다. 이
   것은 파이썬 표현식 "-o"와 동등합니다.

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

   성공 시 *o*를, 실패 시 "NULL"을 반환합니다. 이것은 파이썬 표현식
   "+o"와 동등합니다.

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

   *o*의 절댓값이나, 실패 시 "NULL"을 반환합니다. 이것은 파이썬 표현식
   "abs(o)"와 동등합니다.

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

   성공 시 *o*의 비트 반전(bitwise negation)을, 실패 시 "NULL"을 반환
   합니다. 이것은 파이썬 표현식 "~o"와 동등합니다.

PyObject* PyNumber_Lshift(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*을 *o2*만큼 왼쪽으로 시프트 한 결과를, 실패 시 "NULL"을
   반환합니다. 이것은 파이썬 표현식 "o1 << o2"와 동등합니다.

PyObject* PyNumber_Rshift(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*을 *o2*만큼 오른쪽으로 시프트 한 결과를, 실패 시 "NULL"
   을 반환합니다. 이것은 파이썬 표현식 "o1 >> o2"와 동등합니다.

PyObject* PyNumber_And(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 논리곱(bitwise and)"을, 실패 시
   "NULL"을 반환합니다. 이것은 파이썬 표현식 "o1 & o2"와 동등합니다.

PyObject* PyNumber_Xor(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 배타적 논리합(bitwise exclusive or)"
   을, 실패 시 "NULL"을 반환합니다. 이것은 파이썬 표현식 "o1 ^ o2"와
   동등합니다.

PyObject* PyNumber_Or(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 논리합(bitwise or)"을, 실패 시 "NULL"
   을 반환합니다. 이것은 파이썬 표현식 "o1 | o2"와 동등합니다.

PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 더한 결과나, 실패 시 "NULL"을 반환합니다. 이 연산은
   *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 파이썬 문
   장 "o1 += o2"와 동등합니다.

PyObject* PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*에서 *o2*를 뺀 결과나, 실패 시 "NULL"을 반환합니다. 이 연산은
   *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 파이썬 문
   장 "o1 -= o2"와 동등합니다.

PyObject* PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 곱한 결과나, 실패 시 "NULL"을 반환합니다. 이 연산은
   *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 파이썬 문
   장 "o1 *= o2"와 동등합니다.

PyObject* PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*과 *o2*를 행렬 곱셈한 결과나, 실패 시 "NULL"을 반환합니다. 이
   연산은 *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 파
   이썬 문장 "o1 @= o2"와 동등합니다.

   버전 3.5에 추가.

PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*을 *o2*로 나눈 수학적 플로어(floor)나, 실패 시 "NULL"을 반환합
   니다. 이 연산은 *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다.
   이것은 파이썬 문장 "o1 //= o2"와 동등합니다.

PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   Return a reasonable approximation for the mathematical value of
   *o1* divided by *o2*, or "NULL" on failure.  The return value is
   "approximate" because binary floating point numbers are
   approximate; it is not possible to represent all real numbers in
   base two.  This function can return a floating point value when
   passed two integers.  The operation is done *in-place* when *o1*
   supports it. This is the equivalent of the Python statement "o1 /=
   o2".

PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   *o1*을 *o2*로 나눈 나머지나, 실패 시 "NULL"을 반환합니다. 이 연산은
   *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 파이썬 문
   장 "o1 %= o2"와 동등합니다.

PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3)
    *Return value: New reference.*

   내장 함수 "pow()"를 참조하십시오. 실패하면 "NULL"을 반환합니다. 이
   연산은 *o1*이 지원하면 *제자리에서(in-place)* 수행됩니다. 이것은 o3
   가 "Py_None"일 때 파이썬 문장 "o1 **= o2"와, 그렇지 않으면 "pow(o1,
   o2, o3)"의 제자리 변형과 동등합니다. *o3*를 무시하려면, 그 자리에
   "Py_None"을 전달하십시오 (*o3*에 "NULL"을 전달하면 잘못된 메모리 액
   세스가 발생합니다).

PyObject* PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*을 *o2*만큼 왼쪽으로 시프트 한 결과를, 실패 시 "NULL"을
   반환합니다. 이 연산은 *o1*이 지원하면 *제자리에서(in-place)* 수행됩
   니다. 이것은 파이썬 문장 "o1 <<= o2"와 동등합니다.

PyObject* PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*을 *o2*만큼 오른쪽으로 시프트 한 결과를, 실패 시 "NULL"
   을 반환합니다. 이 연산은 *o1*이 지원하면 *제자리에서(in-place)* 수
   행됩니다. 이것은 파이썬 문장 "o1 >>= o2"와 동등합니다.

PyObject* PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 논리곱(bitwise and)"을, 실패 시
   "NULL"을 반환합니다. 이 연산은 *o1*이 지원하면 *제자리에서(in-
   place)* 수행됩니다. 이것은 파이썬 문장 "o1 &= o2"와 동등합니다.

PyObject* PyNumber_InPlaceXor(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 배타적 논리합(bitwise exclusive or)"
   을, 실패 시 "NULL"을 반환합니다. 이 연산은 *o1*이 지원하면 *제자리
   에서(in-place)* 수행됩니다. 이것은 파이썬 문장 "o1 ^= o2"와 동등합
   니다.

PyObject* PyNumber_InPlaceOr(PyObject *o1, PyObject *o2)
    *Return value: New reference.*

   성공 시 *o1*과 *o2*의 "비트별 논리합(bitwise or)"을, 실패 시 "NULL"
   을 반환합니다. 이 연산은 *o1*이 지원하면 *제자리에서(in-place)* 수
   행됩니다. 이것은 파이썬 문장 "o1 |= o2"와 동등합니다.

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

   성공 시 정수 객체로 변환된 *o*를, 실패 시 "NULL"을 반환합니다. 이것
   은 파이썬 표현식 "int(o)"와 동등합니다.

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

   성공 시 float 객체로 변환된 *o*를, 실패 시 "NULL"을 반환합니다. 이
   것은 파이썬 표현식 "float(o)"와 동등합니다.

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

   성공 시 파이썬 int로 변환된 *o*를, 실패 시 "NULL"을 반환합니다. 실
   패 시 "TypeError" 예외가 발생합니다.

PyObject* PyNumber_ToBase(PyObject *n, int base)
    *Return value: New reference.*

   정수 *n*을 진수 *base*를 사용해서 변환한 문자열을 반환합니다.
   *base* 인자는 2, 8, 10 또는 16중 하나여야 합니다. 진수 2, 8 또는 16
   의 경우, 반환된 문자열은 "'0b'", "'0o'" 또는 "'0x'"의 진수 표시자가
   각각 앞에 붙습니다. *n*이 파이썬 int가 아니면, 먼저
   "PyNumber_Index()"로 변환됩니다.

Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)

   Returns *o* converted to a "Py_ssize_t" value if *o* can be
   interpreted as an integer.  If the call fails, an exception is
   raised and "-1" is returned.

   If *o* can be converted to a Python int but the attempt to convert
   to a "Py_ssize_t" value would raise an "OverflowError", then the
   *exc* argument is the type of exception that will be raised
   (usually "IndexError" or "OverflowError").  If *exc* is "NULL",
   then the exception is cleared and the value is clipped to
   "PY_SSIZE_T_MIN" for a negative integer or "PY_SSIZE_T_MAX" for a
   positive integer.

int PyIndex_Check(PyObject *o)

   Returns "1" if *o* is an index integer (has the "nb_index" slot of
   the "tp_as_number" structure filled in), and "0" otherwise. This
   function always succeeds.
