Results of 1 - 10 of about 28 for PyArg (0.007 sec.)
- 引数の解釈と値の構築 14272
- 引数の解釈と値の構築 これらの関数は、独自の拡張関数やメソッドを作成するときに便利です。 追加の情報や例は Python インタプリタの拡張と埋め込み を参照してください。 最初に説明する 3 つの関数、 PyArg_ParseTuple() , PyArg_ParseTupleAndKeywords()
...,および PyArg_Parse() はいずれも 書式文字列 (format string) を使います。書式文字列は、関数が受け取るはずの引数に関する情報を伝えるのに用...したテキストの内容が入ったバッファへのポインタになります。テキストは最初の引数に指定したエンコード方式でエンコードされます。 PyArg_ParseTuple() を使うと、必要なサイズのバッファを確保し、そのバッファにエンコード後のデータをコピーして、 *buffer がこの新た...に PyMem_Free() で解放する責任があります。 *buffer が非 NULL のポインタ (すでにメモリ確保済みのバッファ) を指している場合、 PyArg_ParseTuple() はこのメモリ位置をバッファとして用い、 *buffer_length の初期値をバッファサイズとして用います。 PyArg_ParseTup... - https://man.mtool.work/python/3.14/c-api/arg.html
- 1. Extending Python with C or C++ 13502
- 1. Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in objec
...ing called): static PyObject * spam_system ( PyObject * self , PyObject * args ) { const char * command ; int sts ; if ( ! PyArg_ParseTuple ( args , "s" , & command )) return NULL ; sts = system ( command ); return PyLong_FromLong ( sts ); } There is...e Python objects --- in order to do anything with them in our C function we have to convert them to C values. The function PyArg_ParseTuple() in the Python API checks the argument types and converts them to C values. It uses a template string to deter...of the arguments as well as the types of the C variables into which to store the converted values. More about this later. PyArg_ParseTuple() returns true (nonzero) if all arguments have the right type and its components have been stored in the variab... - https://man.mtool.work/python/3.14/extending/extending.html
- C API Stability 9487
- C API Stability 特記のない限り、Python の C API には後方互換性ポリシー PEP 387 が適用されます。 変更の大半はソース互換性を保ちます (通常は新しい API の追加だけを行います)。 既存 API の変更や削除は、非推奨の期間を経た後、または重大な問題を修
...EXIST METH_FASTCALL METH_METHOD METH_NOARGS METH_O METH_STATIC METH_VARARGS PY_VECTORCALL_ARGUMENTS_OFFSET PyAIter_Check() PyArg_Parse() PyArg_ParseTuple() PyArg_ParseTupleAndKeywords() PyArg_UnpackTuple() PyArg_VaParse() PyArg_VaParseTupleAndKeywords...() PyArg_ValidateKeywordArguments() PyBUF_ANY_CONTIGUOUS PyBUF_CONTIG PyBUF_CONTIG_RO PyBUF_C_CONTIGUOUS PyBUF_FORMAT PyBUF_FULL Py... - https://man.mtool.work/python/3.14/c-api/stable.html
- 共通のオブジェクト構造体 (common object structure) 8340
- 共通のオブジェクト構造体 (common object structure) Python のオブジェクト型の定義には、多数の構造体が使われます。 この節では、それらの構造体と使い方を説明します。 基本のオブジェクト型とマクロ すべての Python オブジェクトは、メモリ上の表現の先
...ルオブジェクトです。第二のパラメタ (よく args と呼ばれます) は、全ての引数を表現するタプルオブジェクトです。パラメタは通常、 PyArg_ParseTuple() や PyArg_UnpackTuple() で処理されます。 METH_KEYWORDS 他のフラグとの特定の組み合わせでのみ使えます。 使えるの...引数を受け取ります。 kwargs はすべてのキーワード引数を含む辞書で、キーワード引数がなければ NULL の場合もあります。 通常は PyArg_ParseTupleAndKeywords() で引数を処理します。 METH_FASTCALL 次に属します: Stable ABI (バージョン 3.10 より). 位置引数のみを...ンパイラの警告を抑制できます。 METH_O 次に属します: Stable ABI . オブジェクトを 1 つ引数に取るメソッドには、 "O" を指定して PyArg_ParseTuple() を呼び出す代わりに、 METH_O フラグを指定できます。 メソッドは PyCFunction 型で、 self 引数と、唯一の引数を表す... - https://man.mtool.work/python/3.14/c-api/structures.html
- 2. 拡張の型の定義: チュートリアル 8340
- 2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ
...) op ; static char * kwlist [] = { "first" , "last" , "number" , NULL }; PyObject * first = NULL , * last = NULL ; if ( ! PyArg_ParseTupleAndKeywords ( args , kwds , "|OOi" , kwlist , & first , & last , & self -> number )) return -1 ; if ( first ) {...static char * kwlist [] = { "first" , "last" , "number" , NULL }; PyObject * first = NULL , * last = NULL , * tmp ; if ( ! PyArg_ParseTupleAndKeywords ( args , kwds , "|OOi" , kwlist , & first , & last , & self -> number )) return -1 ; if ( first ) {...) op ; static char * kwlist [] = { "first" , "last" , "number" , NULL }; PyObject * first = NULL , * last = NULL ; if ( ! PyArg_ParseTupleAndKeywords ( args , kwds , "|UUi" , kwlist , & first , & last , & self -> number )) return -1 ; if ( first ) {... - https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
- 5. Windows 上での C および C++ 拡張モジュールのビルド 8242
- 5. Windows 上での C および C++ 拡張モジュールのビルド この章では Windows 向けの Python 拡張モジュールを Microsoft Visual C++ を使って作成する方法について簡単に述べ、その後に拡張モジュールのビルドがどのように動作するのかについて詳しい背景を述
...nclude ni . c spam . lib 最初のコマンドは、 spam.obj 、 spam.dll 、 spam.lib の 3 つのファイルを作成します。 Spam.dll には PyArg_ParseTuple() などの Python の関数は含まれていませんが、暗黙にリンクされた pythonXY.lib によって Python のコードを見つけられ...libs / pythonXY . lib 最初のコマンドで、三つのファイル: spam.obj 、 spam.dll および spam.lib ができます。 Spam.dll には ( PyArg_ParseTuple() のような) Python 関数は全く入っていませんが、 pythonXY.lib のおかげで Python コードを見つけることはできます。... - https://man.mtool.work/python/3.14/extending/windows.html
- 3. 拡張の型の定義: 雑多なトピック 8144
- 3. 拡張の型の定義: 雑多なトピック この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであるかについて、ざっと説明します。 以下は PyTypeObject の定義です。 デバッグビルド でしか使われないいくつかのメンバは省いてあります: typ
...obj1('hello') の場合、 self は obj1 になります。 args は呼び出しの引数を格納しているタプルです。ここから引数を取り出すには PyArg_ParseTuple() を使います。 kwds は、渡されたキーワード引数の辞書です。 これが NULL でなく、キーワード引数をサポートする場合...は、 PyArg_ParseTupleAndKeywords() で引数を取り出してください。 キーワード引数をサポートしない場合にこれが NULL でなければ、キーワード...self = ( newdatatypeobject * ) op ; PyObject * result ; const char * arg1 ; const char * arg2 ; const char * arg3 ; if ( ! PyArg_ParseTuple ( args , "sss:call" , & arg1 , & arg2 , & arg3 )) { return NULL ; } result = PyUnicode_FromFormat ( "Returning... - https://man.mtool.work/python/3.14/extending/newtypes.html
- What's New in Python 2.3 7767
- What's New in Python 2.3 著者 : A.M. Kuchling この文書は Python 2.3 の新機能について解説します。Python 2.3 は 2003 年 7 月 29 日にリリースされました。 Python 2.3 の主要なテーマは、2.2 で追加されたいくつかの機能を磨くこと、言語中核に小さいな
...10% 小さくしますが、もちろん Python ビルトインのヘルプが取得できないことにもなります。 (Contributed by Gustavo Niemeyer.) PyArg_NoArgs() マクロが非推奨となったので、これを使っているコードは修正しなければなりません。Python 2.2 以降ではメソッド定義テー...ず、引数チェックを省けることを示すのに METH_NOARGS フラグが使えます。2.2 以前の Python バージョンとの互換性が重要な場合には PyArg_ParseTuple(args, "") を代わりに使えますが、 METH_NOARGS を使うより遅いです。 PyArg_ParseTuple() に符号なし整数の色々なサイ... - https://man.mtool.work/python/3.14/whatsnew/2.3.html
- Unicode オブジェクトと codec 7668
- Unicode オブジェクトと codec Unicode オブジェクト Python 3.3 で PEP 393 が実装されて以来、Unicode オブジェクトは内部で複数の表現形式を使っています。 これにより、メモリ効率を維持しながら Unicode 文字の全範囲を扱えます。 すべてのコードポイント
...て "O&" コンバータを使ってください: int PyUnicode_FSConverter ( PyObject * obj , void * result ) 次に属します: Stable ABI . PyArg_Parse* コンバータ です。 直接、または os.PathLike インターフェースを通じて取得した str オブジェクトを、 PyUnicode_EncodeFS...して "O&" コンバータを使ってください: int PyUnicode_FSDecoder ( PyObject * obj , void * result ) 次に属します: Stable ABI . PyArg_Parse* コンバータ です。 直接、または os.PathLike インターフェースを通じて間接的に取得した bytes オブジェクトを、 PyUnicod... - https://man.mtool.work/python/3.14/c-api/unicode.html
- 1. 他のアプリケーションへの Python の埋め込み 7668
- 1. 他のアプリケーションへの Python の埋め込み 前章では、 Python を拡張する方法、すなわち C 関数のライブラリを Python に結びつけて機能を拡張する方法について述べました。同じようなことを別の方法でも実行できます: それは、自分の C/C++ アプリケー
...プリケーションのコマンドライン引数の数を返す */ static PyObject * emb_numargs ( PyObject * self , PyObject * args ) { if ( ! PyArg_ParseTuple ( args , ":numargs" )) return NULL ; return PyLong_FromLong ( numargs ); } static PyMethodDef emb_module_method... - https://man.mtool.work/python/3.14/extending/embedding.html