Results of 1 - 1 of about 1 for newdatatypeobject (0.001 sec.)
- 3. 拡張の型の定義: 雑多なトピック 9414
- 3. 拡張の型の定義: 雑多なトピック この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであるかについて、ざっと説明します。 以下は PyTypeObject の定義です。 デバッグビルド でしか使われないいくつかのメンバは省いてあります: typ
...もここで解放される必要があります。この関数の例は、以下のようなものです: static void newdatatype_dealloc ( PyObject * op ) { newdatatypeobject * self = ( newdatatypeobject * ) op ; free ( self -> obj_UnderlyingDatatypePtr ); Py_TYPE ( self ) -> tp_free ( self ); }...ールドをクリアする前に PyObject_GC_UnTrack() を呼び出す必要があります。 static void newdatatype_dealloc ( PyObject * op ) { newdatatypeobject * self = ( newdatatypeobject * ) op ; PyObject_GC_UnTrack ( op ); Py_CLEAR ( self -> other_obj ); ... Py_TYPE ( self ) ->...字列オブジェクトを返す必要があります。簡単な例は以下のようなものです: static PyObject * newdatatype_repr ( PyObject * op ) { newdatatypeobject * self = ( newdatatypeobject * ) op ; return PyUnicode_FromFormat ( "Repr-ified_newdatatype{{size:%d}}" , self -> obj_Unde... - https://man.mtool.work/python/3.14/extending/newtypes.html
PREV
1
NEXT