タプルオブジェクト (tuple object)
*********************************

type PyTupleObject

   この "PyObject" のサブタイプは Python のタプルオブジェクトを表現し
   ます。

PyTypeObject PyTuple_Type
    * 次に属します: Stable ABI.*

   この "PyTypeObject" のインスタンスは Python のタプル型を表現します;
   Python レイヤにおける "tuple" と同じオブジェクトです。

int PyTuple_Check(PyObject *p)

   *p* がタプルオブジェクトかタプル型のサブタイプのインスタンスである
   場合に真を返します。この関数は常に成功します。

int PyTuple_CheckExact(PyObject *p)

   *p* がタプルオブジェクトだがタプル型のサブタイプのインスタンスでな
   い場合に真を返します。この関数は常に成功します。

PyObject *PyTuple_New(Py_ssize_t len)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   Return a new tuple object of size *len*, or "NULL" with an
   exception set on failure.

PyObject *PyTuple_Pack(Py_ssize_t n, ...)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   Return a new tuple object of size *n*, or "NULL" with an exception
   set on failure. The tuple values are initialized to the subsequent
   *n* C arguments pointing to Python objects. "PyTuple_Pack(2, a, b)"
   is equivalent to "Py_BuildValue("(OO)", a, b)".

Py_ssize_t PyTuple_Size(PyObject *p)
    * 次に属します: Stable ABI.*

   Take a pointer to a tuple object, and return the size of that
   tuple. On error, return "-1" and with an exception set.

Py_ssize_t PyTuple_GET_SIZE(PyObject *p)

   Like "PyTuple_Size()", but without error checking.

PyObject *PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。** 次に属します: Stable ABI.*

   *p* の指すタプルオブジェクト内の、位置 *pos* にあるオブジェクトを返
   します。 *pos* が負であるか範囲を超えている場合、 "NULL" を返して
   "IndexError" 例外をセットします。

   The returned reference is borrowed from the tuple *p* (that is: it
   is only valid as long as you hold a reference to *p*). To get a
   *strong reference*, use "Py_NewRef(PyTuple_GetItem(...))" or
   "PySequence_GetItem()".

PyObject *PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。*

   "PyTuple_GetItem()" に似ていますが、引数に対するエラーチェックを行
   いません。

PyObject *PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   Return the slice of the tuple pointed to by *p* between *low* and
   *high*, or "NULL" with an exception set on failure.

   This is the equivalent of the Python expression "p[low:high]".
   Indexing from the end of the tuple is not supported.

int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)
    * 次に属します: Stable ABI.*

   *p* の指すタプルオブジェクト内の、位置 *pos* にあるオブジェクトへの
   参照を入れます。成功すれば "0" を返します。 *pos* が範囲を超えてい
   る場合、 "-1" を返して "IndexError" 例外をセットします。

   注釈:

     この関数は *o* への参照を "盗み取り" ます。また、変更先のインデク
     スにすでに別の要素が入っている場合、その要素に対する参照を放棄し
     ます。

void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o)

   "PyTuple_SetItem()" に似ていますが、エラーチェックを行わず、新たな
   タプルに値を入れるとき *以外には使ってはなりません* 。

   Bounds checking is performed as an assertion if Python is built in
   debug mode or "with assertions".

   注釈:

     この関数は *o* への参照を "盗み取り" ます。また、
     "PyTuple_SetItem()" と違って、要素の置き換えが生じても置き換えら
     れるオブジェクトへの参照を放棄 *しません* ; その結果、タプル中の
     位置 *pos* で参照されていたオブジェクトがメモリリークを引き起こし
     ます。

   警告:

     This macro should *only* be used on tuples that are newly
     created. Using this macro on a tuple that is already in use (or
     in other words, has a refcount > 1) could lead to undefined
     behavior.

int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)

   タプルをリサイズする際に使えます。 *newsize* はタプルの新たな長さで
   す。タプルは変更不能なオブジェクト *ということになっている* ので、
   この関数はこのオブジェクトに対してただ一つしか参照がない時以外には
   使ってはなりません。タプルがコード中の他の部分ですでに参照されてい
   る場合には、この関数を *使ってはなりません* 。タプルは常に指定サイ
   ズの末尾まで伸縮します。成功した場合には "0" を返します。クライアン
   トコードは、 "*p" の値が呼び出し前と同じになると期待してはなりませ
   ん。 "*p" が置き換えられた場合、オリジナルの "*p" は破壊されます。
   失敗すると "-1" を返し、 "*p" を "NULL" に設定して、  "MemoryError"
   または "SystemError" を送出します。


Struct Sequence オブジェクト
****************************

struct sequence オブジェクトは "namedtuple()" オブジェクトと等価なC オ
ブジェクトです。 つまり、その要素に属性を通してアクセスすることができ
るシーケンスです。 struct sequence を生成するには、まず特定のstruct
sequence 型を生成しなければなりません。

PyTypeObject *PyStructSequence_NewType(PyStructSequence_Desc *desc)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   後述の *desc* 中のデータから新しい struct sequence 型を生成します。
   返される型のインスタンスは "PyStructSequence_New()" で生成できます
   。

   Return "NULL" with an exception set on failure.

void PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)

   struct sequence 型である *type* を *desc* をもとにその場で初期化し
   ます。

int PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)

   Like "PyStructSequence_InitType()", but returns "0" on success and
   "-1" with an exception set on failure.

   Added in version 3.4.

type PyStructSequence_Desc
    * 次に属します: Stable ABI (すべてのメンバーを含む).*

   生成するstruct sequence 型のメタデータを保持します。

   const char *name

      Name of the struct sequence type.

   const char *doc

      Pointer to docstring for the type or "NULL" to omit.

   PyStructSequence_Field *fields

      Pointer to "NULL"-terminated array with field names of the new
      type.

   int n_in_sequence

      Number of fields visible to the Python side (if used as tuple).

type PyStructSequence_Field
    * 次に属します: Stable ABI (すべてのメンバーを含む).*

   Describes a field of a struct sequence. As a struct sequence is
   modeled as a tuple, all fields are typed as PyObject*.  The index
   in the "fields" array of the "PyStructSequence_Desc" determines
   which field of the struct sequence is described.

   const char *name

      Name for the field or "NULL" to end the list of named fields,
      set to "PyStructSequence_UnnamedField" to leave unnamed.

   const char *doc

      Field docstring or "NULL" to omit.

const char *const PyStructSequence_UnnamedField
    * 次に属します: Stable ABI (バージョン 3.11 より).*

   フィールド名を名前がないままするための特殊な値。

   バージョン 3.9 で変更: 型が "char *" から変更されました。

PyObject *PyStructSequence_New(PyTypeObject *type)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   *type* のインスタンスを生成します。 *type* は
   "PyStructSequence_NewType()" によって事前に生成していなければなりま
   せん。

   Return "NULL" with an exception set on failure.

PyObject *PyStructSequence_GetItem(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。** 次に属します: Stable ABI.*

   Return the object at position *pos* in the struct sequence pointed
   to by *p*.

   Bounds checking is performed as an assertion if Python is built in
   debug mode or "with assertions".

PyObject *PyStructSequence_GET_ITEM(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。*

   Alias to "PyStructSequence_GetItem()".

   バージョン 3.13 で変更: Now implemented as an alias to
   "PyStructSequence_GetItem()".

void PyStructSequence_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)
    * 次に属します: Stable ABI.*

   struct sequence *p* の *pos* の位置にあるフィールドに値 *o* を設定
   します。"PyTuple_SET_ITEM()" のように、生成したてのインスタンスに対
   してのみ使用すべきです。

   Bounds checking is performed as an assertion if Python is built in
   debug mode or "with assertions".

   注釈:

     この関数は *o* への参照を "盗み取り" ます。

void PyStructSequence_SET_ITEM(PyObject *p, Py_ssize_t *pos, PyObject *o)

   Alias to "PyStructSequence_SetItem()".

   バージョン 3.13 で変更: Now implemented as an alias to
   "PyStructSequence_SetItem()".
