モジュールオブジェクト (module object)
**************************************

There are only a few functions special to module objects.

PyTypeObject PyModule_Type

   この "PyTypeObject" のインスタンスは Python のモジュールオブジェク
   ト型を表現します。このオブジェクトは、Python プログラムには
   "types.ModuleType"  として公開されています。

int PyModule_Check(PyObject *p)

   *p* がモジュールオブジェクトかモジュールオブジェクトのサブタイプで
   あるときに真を返します。

   バージョン 2.2 で変更: Allowed subtypes to be accepted.

int PyModule_CheckExact(PyObject *p)

   *p* がモジュールオブジェクトで、かつモジュールオブジェクトのサブタ
   イプでないときに真を返します。 "PyModule_Type".

   バージョン 2.2 で追加.

PyObject* PyModule_New(const char *name)
    *Return value: New reference.*

   Return a new module object with the "__name__" attribute set to
   *name*. Only the module’s "__doc__" and "__name__" attributes are
   filled in; the caller is responsible for providing a "__file__"
   attribute.

PyObject* PyModule_GetDict(PyObject *module)
    *Return value: Borrowed reference.*

   Return the dictionary object that implements *module*’s namespace;
   this object is the same as the "__dict__" attribute of the module
   object.  This function never fails.  It is recommended extensions
   use other "PyModule_*()" and "PyObject_*()" functions rather than
   directly manipulate a module’s "__dict__".

char* PyModule_GetName(PyObject *module)

   *module* の "__name__" の値を返します。モジュールがこの属性を提供し
   ていない場合や文字列型でない場合、 "SystemError" を送出して *NULL*
   を返します。

char* PyModule_GetFilename(PyObject *module)

   Return the name of the file from which *module* was loaded using
   *module*’s "__file__" attribute.  If this is not defined, or if it
   is not a string, raise "SystemError" and return *NULL*.

int PyModule_AddObject(PyObject *module, const char *name, PyObject *value)

   *module* にオブジェクトを *name* として追加します。 この関数はモジ
   ュールの初期化関数から利用される便利関数です。 これは *value* への
   参照を盗みます。 エラーのときには "-1" を、成功したときには "0" を
   返します。

   バージョン 2.0 で追加.

int PyModule_AddIntConstant(PyObject *module, const char *name, long value)

   *module* に整数定数を *name* として追加します。この便宜関数はモジュ
   ールの初期化関数から利用されています。エラーのときには "-1" を、成
   功したときには "0" を返します。

   バージョン 2.0 で追加.

int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)

   Add a string constant to *module* as *name*.  This convenience
   function can be used from the module’s initialization function.
   The string *value* must be null-terminated.  Return "-1" on error,
   "0" on success.

   バージョン 2.0 で追加.

int PyModule_AddIntMacro(PyObject *module, macro)

   *module* に int 定数を追加します。名前と値は *macro* から取得されま
   す。例えば、 "PyModule_AddIntMacro(module, AF_INET)" とすると、
   *AF_INET* という名前の int 型定数を *AF_INET* の値で *module* に追
   加します。エラー時には "-1" を、成功時には "0" を返します。

   バージョン 2.6 で追加.

int PyModule_AddStringMacro(PyObject *module, macro)

      文字列定数を *module* に追加します。

   バージョン 2.6 で追加.
