Results of 1 - 10 of about 63 for struct (0.003 sec.)
- struct --- バイト列をパックされたバイナリデータとして解釈する 15196
- struct --- バイト列をパックされたバイナリデータとして解釈する ソースコード: Lib/struct.py このモジュールは、Python の値と、Python の bytes オブジェクトで表した C の構造体との間の変換を行います。 簡潔な 書式文字列 で、Python の値との変換方法
...素間のパディングをプログラマーが定義する必要があります。 詳しくは バイトオーダ、サイズ、アラインメント を参照してください。 struct のいくつかの関数 (と Struct のメソッド) は buffer 引数を受け取ります。 この引数には バッファプロトコル (buffer Protocol) を...ブジェクトからの余分なコピーなしに読み書きできます。 関数と例外 このモジュールは以下の例外と関数を定義しています: exception struct. error 様々な状況で送出される例外です。引数は何が問題なのかを記述する文字列です。 struct. pack ( format , v1 , v2 , ... )...v1 、 v2 、... をパックしたバイト列オブジェクトを返します。 引数は、書式が要求する値に正確に対応していなければなりません。 struct. pack_into ( format , buffer , offset , v1 , v2 , ... ) 書式文字列 format に従って値 v1 、 v2 、... をパックし、書き込み可... - https://man.mtool.work/python/3.14/library/struct.html
- タプルオブジェクト (tuple object) 12070
- タプルオブジェクト (tuple object) type PyTupleObject この PyObject のサブタイプは Python のタプルオブジェクトを表現します。 PyTypeObject PyTuple_Type 次に属します: Stable ABI . この PyTypeObject のインスタンスは Python のタプル型を表現します
...合、元の *p は破棄されます。 失敗した場合は -1 を返し、 *p を NULL に設定して MemoryError または SystemError を送出します。 Struct Sequence オブジェクト Struct sequence objects are the C equivalent of namedtuple() objects, i.e. a sequence whose items ca...n also be accessed through attributes. To create a struct sequence, you first have to create a specific struct sequence type. PyTypeObject * PyStructSequence_NewType ( PyStructSequ...ence_Desc * desc ) 戻り値: 新しい参照。 次に属します: Stable ABI . 後述の desc 中のデータから新しい struct sequence 型を生成します。返される型のインスタンスは PyStructSequence_New() で生成できます。 失敗した場合は例外を設定して N... - https://man.mtool.work/python/3.14/c-api/tuple.html
- time --- 時刻データへのアクセスと変換 10558
- time --- 時刻データへのアクセスと変換 このモジュールでは、時刻に関するさまざまな関数を提供します。関連した機能について、 datetime , calendar モジュールも参照してください。 このモジュールは常に利用可能ですが、すべての関数がすべてのプラットフ
...ime() , localtime() , strptime() の戻り値は個々の値を属性名で取得することもできます。 これらのオブジェクトについての解説は struct_time を参照してください。 バージョン 3.3 で変更: struct_time オブジェクトは、プラットフォームが、対応する struct tm メンバ...ーをサポートしている場合、 tm_gmtoff および tm_zone 属性が拡張されるようになりました。 バージョン 3.6 で変更: struct_time の属性 tm_gmtoff および tm_zone が全てのプラットフォームで利用できるようになりました。 時間の表現を変換するには、以下...の関数を利用してください: 対象 変換先 関数 エポックからの秒数 UTC の struct_time gmtime() エポックからの秒数 ローカル時間の struct_time localtime() UTC の struct_time エポックからの秒数 calendar.tim... - https://man.mtool.work/python/3.14/library/time.html
- デスクリプタオブジェクト (descriptor object) 8843
- デスクリプタオブジェクト (descriptor object) "デスクリプタ (descriptor)" は、あるオブジェクトのいくつかの属性について記述したオブジェクトです。デスクリプタオブジェクトは型オブジェクトの辞書内にあります。 PyTypeObject PyProperty_Type 次に属し
...ます: Stable ABI . The type object for the built-in descriptor types. PyObject * PyDescr_NewGetSet ( PyTypeObject * type , struct PyGetSetDef * getset ) 戻り値: 新しい参照。 次に属します: Stable ABI . PyGetSetDef 構造体 getset から、拡張型 type 用の新し...プタへの 強参照 を返します。 失敗すると例外を設定して NULL を返します。 PyObject * PyDescr_NewMember ( PyTypeObject * type , struct PyMemberDef * member ) 戻り値: 新しい参照。 次に属します: Stable ABI . PyMemberDef 構造体 member から、拡張型 type 用の新し...ます。 Python の types.GetSetDescriptorType オブジェクトに対応します。 PyObject * PyDescr_NewMethod ( PyTypeObject * type , struct PyMethodDef * meth ) 戻り値: 新しい参照。 次に属します: Stable ABI . PyMethodDef 構造体 meth から、拡張型 type 用の新しいメ... - https://man.mtool.work/python/3.14/c-api/descriptor.html
- 拡張モジュールを分離する 8843
- 拡張モジュールを分離する 概要 従来、Python 拡張モジュールの状態は、プロセス全体をスコープとする C の static 変数に保持されていました。 このドキュメントでは、プロセスごとの状態が抱える問題と、より安全な方法であるモジュールごとの状態について説
...そのバイト数のモジュール専用の記憶領域を確保できます。 通常は、モジュールの C レベルの状態をすべて格納する、モジュール固有の struct のサイズを指定します。 特に、C コードの動作に必要なクラスへのポインタ (例外を含み、静的な型を除きます) や、 csv の field_s...れます。 PyModule_GetState を使うと状態を取得できます。 static PyObject * func ( PyObject * module , PyObject * args ) { my_struct * state = ( my_struct * ) PyModule_GetState ( module ); if ( state == NULL ) { return NULL ; } // ... 残りの処理 } 注釈 モ...でその状態を取得できます。 エラー処理の定型コードを省くには、 PyType_GetModuleState() でこの二つの手順をまとめられます。 my_struct * state = ( my_struct * ) PyType_GetModuleState ( type ); if ( state == NULL ) { return NULL ; } 通常のメソッドからモジュー... - https://man.mtool.work/python/3.14/howto/isolating-extensions.html
- Expat C API 8627
- Expat C API The xml.parsers.expat module exposes selected Expat functions through its expat_CAPI capsule. This allows extension modules to use the same Expat library as Python. The interface is declared in pyexpat.h , which must be included
...at_CAPI . PyExpat_CAPI_MAGIC The string identifying the layout of PyExpat_CAPI . Before using the function pointers in the structure, check that its magic member compares equal to this string using strcmp() and its size member is at least sizeof ( stru...ct PyExpat_CAPI ) . struct PyExpat_CAPI Table of function pointers exported by xml.parsers.expat . The capsule owns this structure: treat it as read-...IC before using the function pointers. char * magic Interface identifier, set to PyExpat_CAPI_MAGIC . int size Size of the structure in bytes, set to sizeof(struct PyExpat_CAPI) by the xml.parsers.expat module that created the capsule. int MAJOR_VERSIO... - https://man.mtool.work/python/3.14/c-api/pyexpat.html
- モジュールのインポート 8411
- モジュールのインポート PyObject * PyImport_ImportModule ( const char * name ) 戻り値: 新しい参照。 次に属します: Stable ABI . PyImport_Import() のラッパーで、引数として PyObject * の代わりに const char * を受け取ります。 PyObject * PyImport
...ABI . PyImport_ImportFrozenModuleObject() と同様ですが、名前は Unicode オブジェクトではなく UTF-8 エンコードの文字列です。 struct _frozen This is the structure type definition for frozen module descriptors, as generated by the freeze utility (see Tools.../freeze/ in the Python source distribution). Its definition, found in Include/import.h , is: struct _frozen { const char * name ; /* ASCII encoded string */ const unsigned char * code ; int size ; int is_package ; }; バージ...age フィールドは、モジュールがパッケージかどうかを示します。 size フィールドを負の値に設定する方法に代わるものです。 const struct _frozen * PyImport_FrozenModules このポインタは _frozen のレコードからなり、終端の要素のメンバが NULL かゼロになっているよ... - https://man.mtool.work/python/3.14/c-api/import.html
- fcntl --- fcntl および ioctl システムコール 8311
- fcntl --- fcntl および ioctl システムコール このモジュールはファイル記述子に対するファイル制御と I/O 制御を行います。 Unix の fcntl() と ioctl() ルーチンへのインターフェイスです。 詳細は Unix のマニュアルページ fcntl(2) と ioctl(2) を参照し
...が整数の場合、C の fcntl() 呼び出しの整数の返り値を返します。 When the argument is bytes-like object, it represents a binary structure, for example, created by struct.pack() . A string value is encoded to binary using the UTF-8 encoding. The binary data...ely to result in a segmentation violation or a more subtle data corruption. 以下に例を示します: >>> import array , fcntl , struct , termios , os >>> os . getpgrp () 13341 >>> struct . unpack ( 'h' , fcntl . ioctl ( 0 , termios . TIOCGPGRP , " " ))[ 0 ]...定して 監査イベント fcntl.lockf を送出します。 以下に例を示します。 いずれも SVR4 準拠のシステムで実行したものです。 import struct , fcntl , os f = open ( ... ) rv = fcntl . fcntl ( f , fcntl . F_SETFL , os . O_NDELAY ) lockdata = struct . pack ( 'hhllh... - https://man.mtool.work/python/3.14/library/fcntl.html
- フレーム (frame) オブジェクト 8094
- フレーム (frame) オブジェクト type PyFrameObject 次に属します: Limited API (不透明な構造体として). フレームオブジェクトを記述する際に用いられる、オブジェクトを表す C 構造体です。 この構造体には公開メンバはありません。 バージョン 3.11 で変更
...deprecated> : この関数は何も行わなくなりました。 参考 PEP 667 内部フレーム PEP 523 を使わない限り、これは必要ありません。 struct _PyInterpreterFrame インタープリタ内部でのフレーム表現。 Added in version 3.11. PyObject * PyUnstable_InterpreterFrame_Get...Code ( struct _PyInterpreterFrame * frame ) ; これは Unstable API です。マイナーリリースで予告なく変更されることがあります。 フレームのコ...ードオブジェクトへの 強参照 を返します。 Added in version 3.12. int PyUnstable_InterpreterFrame_GetLasti ( struct _PyInterpreterFrame * frame ) ; これは Unstable API です。マイナーリリースで予告なく変更されることがあります。 最後に実行し... - https://man.mtool.work/python/3.14/c-api/frame.html
- 2. 拡張の型の定義: チュートリアル 8094
- 2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ
...の型も定義できますが、これについてはこのチュートリアルでは扱いません。 #define PY_SSIZE_T_CLEAN #include <Python.h> typedef struct { PyObject_HEAD /* 型固有のフィールドをここに記述します。 */ } CustomObject ; static PyTypeObject CustomType = { . ob_base...構造体、および新しいモジュールオブジェクトを設定する custom_module_exec 関数がこれに当たります。 まず最初はこれです: typedef struct { PyObject_HEAD } CustomObject ; これが Custom オブジェクトの内容です。 各オブジェクト構造体の先頭には PyObject_HEAD が必須...PyObject_HEAD ボイラープレートの他にもデータを保持しています; 例えば、これは Python 標準の浮動小数点数の定義です: typedef struct { PyObject_HEAD double ob_fval ; } PyFloatObject ; 2つ目は型オブジェクトの定義です。 static PyTypeObject CustomType = { .... - https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html