タプルオブジェクト (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.** Thread safety:
   Atomic.*

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

PyObject *PyTuple_FromArray(PyObject *const *array, Py_ssize_t size)
    * Thread safety: Atomic.*

   Create a tuple of *size* items and copy references from *array* to
   the new tuple.

   *array* can be NULL if *size* is "0".

   On success, return a new reference. On error, set an exception and
   return "NULL".

   Added in version 3.15.

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

   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.** Thread safety: Atomic.*

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

Py_ssize_t PyTuple_GET_SIZE(PyObject *p)
    * Thread safety: Atomic.*

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

PyObject *PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。** 次に属します: Stable ABI.** Thread safety:
   Safe to call from multiple threads with external synchronization
   only.*

   *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)
    *戻り値: 借用参照。** Thread safety: Safe to call from multiple
   threads with external synchronization only.*

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

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

   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.** Thread safety: Safe to call from
   multiple threads with external synchronization only.*

   Insert a reference to object *o* at position *pos* of the tuple
   pointed to by *p*.  Return "0" on success.  If *pos* is out of
   bounds, return "-1" and set an "IndexError" exception. This
   function should only be used to fill in brand new tuples; using it
   on an existing tuple is thread-unsafe.

   注釈:

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

void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o)
    * Thread safety: Safe to call from multiple threads with external
   synchronization only.*

   Like "PyTuple_SetItem()", but does no error checking, and should
   *only* be used to fill in brand new tuples, using it on an existing
   tuple is thread-unsafe.

   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)
    * Thread safety: Safe to call from multiple threads with external
   synchronization only.*

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


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

A struct sequence object is a *named tuple*, that is, a sequence whose
items can also be accessed through attributes. It is similar to
"collections.namedtuple()", but provides a slightly different
interface.

To create a struct sequence, you first have to create a specific
struct sequence type.

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

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

   Return "NULL" with an exception set on failure.

void PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)
    * Thread safety: Safe to call without external synchronization on
   distinct objects.*

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

int PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)
    * Thread safety: Safe to call without external synchronization on
   distinct objects.*

   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

      Fully qualified name of the type; null-terminated UTF-8 encoded.
      The name must contain the module name.

   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.** Thread safety:
   Atomic.*

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

   Return "NULL" with an exception set on failure.

PyObject *PyStructSequence_GetItem(PyObject *p, Py_ssize_t pos)
    *戻り値: 借用参照。** 次に属します: Stable ABI.** Thread safety:
   Safe to call from multiple threads with external synchronization
   only.*

   Return the object at position *pos* in the struct sequence pointed
   to by *p*. The returned reference is borrowed from the struct
   sequence *p* (that is: it is only valid as long as you hold a
   reference to *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)
    *戻り値: 借用参照。** Thread safety: Safe to call from multiple
   threads with external synchronization only.*

   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.** Thread safety: Safe to call from
   multiple threads with external synchronization only.*

   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)
    * Thread safety: Safe to call from multiple threads with external
   synchronization only.*

   Alias to "PyStructSequence_SetItem()".

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