本文整理汇总了C#中PyObject.IncRef方法的典型用法代码示例。如果您正苦于以下问题:C# PyObject.IncRef方法的具体用法?C# PyObject.IncRef怎么用?C# PyObject.IncRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObject
的用法示例。
在下文中一共展示了PyObject.IncRef方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
protected void Initialize()
{
if (!Initialized)
{
Module = new PyObject(Python.InitModule(Name, Methods.ToArray()), ReferenceType.Borrowed);
Module.IncRef();
Initialized = true;
}
}
示例2: PyTraceback
internal PyTraceback(PyObject trace)
{
_trace = trace;
trace.IncRef();
}
示例3: PyException
public PyException(IntPtr type, IntPtr value, IntPtr traceback)
{
TypeObject = new PyObject(type);
ValueObject = new PyObject(value);
TracebackObject = new PyObject(traceback);
TypeObject.IncRef();
ValueObject.IncRef();
TracebackObject.IncRef();
Type = TypeObject.GetString("__name__");
if (ValueObject.IsString)
Value = PyString.GetValueInternal(ValueObject.Pointer);
else if (ValueObject.HasAttr("message"))
Value = ValueObject.GetString("message");
else // use Py_Repr to atleast get some information
Value = ValueObject.ToString();
CallStack = new List<PyTraceback>(5);
var cur = TracebackObject;
while (cur != null && cur.IsValid && !cur.IsNone)
{
CallStack.Add(new PyTraceback(cur));
cur = cur.Get("tb_next");
}
}
示例4: PyStackFrame
internal PyStackFrame(PyObject frame)
{
_frame = frame;
frame.IncRef();
}
示例5: PyCode
public PyCode(PyObject code)
{
_code = code;
code.IncRef();
RawBytecode = code.GetRaw("co_code");
Name = code.GetString("co_name");
File = code.GetString("co_filename");
Bytecode = new PyBytecode(this);
}