Class: PyCall::PyTypePtr

Inherits:
PyPtr
  • Object
show all
Defined in:
ext/pycall/pycall.c

Constant Summary

Constants inherited from PyPtr

PyCall::PyPtr::NULL

Instance Method Summary collapse

Methods inherited from PyPtr

#==, #__address__, #__ob_refcnt__, #__ob_type__, #class, decref, #eql?, #hash, incref, #initialize, #inspect, #is_a?, #kind_of?, #nil?, #none?, #null?, #object_id, sizeof

Constructor Details

This class inherits a constructor from PyCall::PyPtr

Instance Method Details

#===(other) ⇒ Object



529
530
531
532
533
534
535
# File 'ext/pycall/pycall.c', line 529

static VALUE
pycall_pytypeptr_eqq(VALUE obj, VALUE other)
{
  if (is_pycall_pyptr(other))
    return pycall_pyptr_is_kind_of(other, obj);
  return Qfalse;
}

#__ob_size__Object



486
487
488
489
490
491
492
493
# File 'ext/pycall/pycall.c', line 486

static VALUE
pycall_pytypeptr_get_ob_size(VALUE obj)
{
  PyTypeObject* pytype = get_pytypeobj_ptr(obj);
  if (pytype)
    return SSIZET2NUM(pytype->ob_size);
  return Qnil;
}

#__tp_basicsize__Object



507
508
509
510
511
512
513
514
515
516
# File 'ext/pycall/pycall.c', line 507

static VALUE
pycall_pytypeptr_get_tp_basicsize(VALUE obj)
{
  PyTypeObject* pytype = get_pytypeobj_ptr(obj);
  if (pytype) {
    if (Py_TYPE(pytype) == Py_API(PyType_Type))
      return SSIZET2NUM(pytype->tp_basicsize);
  }
  return Qnil;
}

#__tp_flags__Object



518
519
520
521
522
523
524
525
526
527
# File 'ext/pycall/pycall.c', line 518

static VALUE
pycall_pytypeptr_get_tp_flags(VALUE obj)
{
  PyTypeObject* pytype = get_pytypeobj_ptr(obj);
  if (pytype) {
    if (Py_TYPE(pytype) == Py_API(PyType_Type))
      return ULONG2NUM(pytype->tp_flags);
  }
  return Qnil;
}

#__tp_name__Object



495
496
497
498
499
500
501
502
503
504
505
# File 'ext/pycall/pycall.c', line 495

static VALUE
pycall_pytypeptr_get_tp_name(VALUE obj)
{
  PyTypeObject* pytype = get_pytypeobj_ptr(obj);
  if (pytype) {
    if (Py_TYPE(pytype) == Py_API(PyType_Type))
      return rb_str_new2(pytype->tp_name);
    return pycall_pyobject_to_ruby(((PyClassObject *)pytype)->cl_name);
  }
  return Qnil;
}