picop.cyobject#
Object protocol helpers.
- picop.cyobject.obj_as_fd(o)#
Return a file descriptor via
PyObject_AsFileDescriptor.Notes
On error raises — do not treat the result as a boolean success flag.
- picop.cyobject.obj_bytes(o)#
Return
bytes(o)viaPyObject_Bytes. :type o:object:param o:- Return type:
- picop.cyobject.obj_call(callable_object, args, kw=None)#
Call
callable_object(*args, **kw)viaPyObject_Call.Notes
argsmust be a tuple.
- picop.cyobject.obj_call_object(callable_object, args)#
Call
callable_object(*args)viaPyObject_CallObject. :type callable_object:object:param callable_object: :type args:object:param args:- Return type:
- picop.cyobject.obj_callable(o)#
- picop.cyobject.obj_delattr(o, name)#
Delete attribute
nameonoviaPyObject_DelAttr.Notes
Returns
0on success; errors raise — do not use the status as a bool.
- picop.cyobject.obj_delattr_cstr(o, name)#
Delete C-string attribute
nameviaPyObject_DelAttrString.Notes
namemust bebytes, notstr. Returns0on success; errors raise — do not use the status as a bool. Alias ofobj_delattr_string.
- picop.cyobject.obj_delitem(o, key)#
Delete
o[key]viaPyObject_DelItem.Notes
Returns
0on success; errors raise — do not use the status as a bool.
- picop.cyobject.obj_eq(a, b)#
Return True if
a == bviaPyObject_RichCompareBool.Notes
Identity short-circuit applies. Prefer typed
*_eqwhen both operands have a known Core type.
- picop.cyobject.obj_format(obj, format_spec)#
Return
format(obj, format_spec)viaPyObject_Format. :type obj:object:param obj: :type format_spec:object:param format_spec:- Return type:
- picop.cyobject.obj_getattr(o, name)#
- picop.cyobject.obj_getattr_cstr(o, name)#
- picop.cyobject.obj_getitem(o, key)#
- picop.cyobject.obj_hasattr(o, name)#
- picop.cyobject.obj_hasattr_cstr(o, name)#
- picop.cyobject.obj_hash(o)#
- picop.cyobject.obj_isinstance(inst, cls)#
- picop.cyobject.obj_issubclass(derived, cls)#
Return
issubclass(derived, cls)viaPyObject_IsSubclass. :type derived:object:param derived: :type cls:object:param cls:- Return type:
- picop.cyobject.obj_istrue(o)#
- picop.cyobject.obj_iter(o)#
Return
iter(o)viaPyObject_GetIter. :type o:object:param o:- Return type:
- picop.cyobject.obj_len(o)#
- picop.cyobject.obj_length_hint(o, default_value)#
Return
operator.length_hint(o, default_value)viaPyObject_LengthHint. :type o:object:param o: :type default_value:int:param default_value:- Return type:
- picop.cyobject.obj_repr(o)#
Return
repr(o)viaPyObject_Repr. :type o:object:param o:- Return type:
- picop.cyobject.obj_richcompare(o1, o2, opid)#
Return rich comparison of
o1ando2foropid(Py_EQ…). :type o1:object:param o1: :type o2:object:param o2: :type opid:int:param opid:- Return type:
- picop.cyobject.obj_richcompare_bool(o1, o2, opid)#
Return rich comparison as bool for
opid(PyObject_RichCompareBool). :type o1:object:param o1: :type o2:object:param o2: :type opid:int:param opid:- Return type:
- picop.cyobject.obj_setattr(o, name, v)#
Set attribute
nameonoviaPyObject_SetAttr.Notes
Returns
0on success; errors raise — do not use the status as a bool.
- picop.cyobject.obj_setattr_cstr(o, name, v)#
Set C-string attribute
nameonoviaPyObject_SetAttrString.Notes
namemust bebytes, notstr. Returns0on success; errors raise — do not use the status as a bool. Alias ofobj_setattr_string.
- picop.cyobject.obj_setitem(o, key, v)#
Set
o[key] = vviaPyObject_SetItem.Notes
Returns
0on success; errors raise — do not use the status as a bool.
- picop.cyobject.obj_size(o)#
- picop.cyobject.obj_str(o)#
- picop.cyobject.obj_type(o)#