本文整理汇总了C#中IronPython.Runtime.Types.PythonType.__getattribute__方法的典型用法代码示例。如果您正苦于以下问题:C# PythonType.__getattribute__方法的具体用法?C# PythonType.__getattribute__怎么用?C# PythonType.__getattribute__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.Types.PythonType
的用法示例。
在下文中一共展示了PythonType.__getattribute__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreTyped
StoreTyped(PythonType _type)
{
uint typeSize = (uint)Marshal.SizeOf(typeof(PyTypeObject));
IntPtr typePtr = this.allocator.Alloc(typeSize);
CPyMarshal.Zero(typePtr, typeSize);
CPyMarshal.WriteIntField(typePtr, typeof(PyTypeObject), "ob_refcnt", 2);
object ob_type = PythonCalls.Call(this.scratchContext, Builtin.type, new object[] { _type });
CPyMarshal.WritePtrField(typePtr, typeof(PyTypeObject), "ob_type", this.Store(ob_type));
string tp_name = (string)_type.__getattribute__(this.scratchContext, "__name__");
CPyMarshal.WritePtrField(typePtr, typeof(PyTypeObject), "tp_name", this.Store(tp_name));
PythonTuple tp_bases = (PythonTuple)_type.__getattribute__(this.scratchContext, "__bases__");
object tp_base = tp_bases[0];
CPyMarshal.WritePtrField(typePtr, typeof(PyTypeObject), "tp_base", this.Store(tp_base));
if (tp_bases.__len__() > 1)
{
CPyMarshal.WritePtrField(typePtr, typeof(PyTypeObject), "tp_bases", this.Store(tp_bases));
}
this.scratchModule.Get__dict__()["_ironclad_bases"] = tp_bases;
this.scratchModule.Get__dict__()["_ironclad_metaclass"] = ob_type;
this.ExecInModule(CodeSnippets.CLASS_STUB_CODE, this.scratchModule);
this.classStubs[typePtr] = this.scratchModule.Get__dict__()["_ironclad_class_stub"];
this.actualisableTypes[typePtr] = new ActualiseDelegate(this.ActualiseArbitraryObject);
this.map.Associate(typePtr, _type);
this.PyType_Ready(typePtr);
return typePtr;
}