github.com/goplus/llgo@v0.8.3/py/type.go (about)

     1  /*
     2   * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package py
    18  
    19  import (
    20  	_ "unsafe"
    21  )
    22  
    23  // https://docs.python.org/3/c-api/type.html
    24  
    25  // Return the type’s name. Equivalent to getting the type’s __name__ attribute.
    26  //
    27  // llgo:link (*Object).TypeName C.PyType_GetName
    28  func (t *Object) TypeName() *Object { return nil }
    29  
    30  // Return the tp_flags member of type. This function is primarily meant for use
    31  // with Py_LIMITED_API; the individual flag bits are guaranteed to be stable across
    32  // Python releases, but access to tp_flags itself is not part of the limited API.
    33  //
    34  // llgo:link (*Object).TypeFlags C.PyType_GetFlags
    35  func (t *Object) TypeFlags() uint32 { return 0 }
    36  
    37  // Return the module object associated with the given type when the type was created
    38  // using PyType_FromModuleAndSpec().
    39  //
    40  // If no module is associated with the given type, sets TypeError and returns nil.
    41  //
    42  // This function is usually used to get the module in which a method is defined. Note
    43  // that in such a method, Py_TYPE(self).Module() may not return the intended result.
    44  // Py_TYPE(self) may be a subclass of the intended class, and subclasses are not
    45  // necessarily defined in the same module as their superclass. See PyCMethod to get
    46  // the class that defines the method. See ModuleByDef() for cases when PyCMethod
    47  // cannot be used.
    48  //
    49  // llgo:link (*Object).TypeModule C.PyType_GetModule
    50  func (t *Object) TypeModule() *Object { return nil }
    51  
    52  // llgo:link (*Object).TypeModuleByDef C.PyType_GetModuleByDef
    53  // func (t *Object) TypeModuleByDef(def *ModuleDef) *Object { return nil }