[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/sdpython/pythonnet/v2.5.0/src/runtime/interop.cs [Back]  [Original]

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Text;
using System.Collections.Generic;

namespace Python.Runtime
{
    /// 
    /// This file defines objects to support binary interop with the Python
    /// runtime. Generally, the definitions here need to be kept up to date
    /// when moving to new Python versions.
    /// 
    [Serializable]
    [AttributeUsage(AttributeTargets.All)]
    public class DocStringAttribute : Attribute
    {
        public DocStringAttribute(string docStr)
        {
            DocString = docStr;
        }

        public string DocString
        {
            get { return docStr; }
            set { docStr = value; }
        }

        private string docStr;
    }

    [Serializable]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate)]
    internal class PythonMethodAttribute : Attribute
    {
        public PythonMethodAttribute()
        {
        }
    }

    [Serializable]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate)]
    internal class ModuleFunctionAttribute : Attribute
    {
        public ModuleFunctionAttribute()
        {
        }
    }

    [Serializable]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate)]
    internal class ForbidPythonThreadsAttribute : Attribute
    {
        public ForbidPythonThreadsAttribute()
        {
        }
    }


    [Serializable]
    [AttributeUsage(AttributeTargets.Property)]
    internal class ModulePropertyAttribute : Attribute
    {
        public ModulePropertyAttribute()
        {
        }
    }

    internal static class ManagedDataOffsets
    {
        static ManagedDataOffsets()
        {
            FieldInfo[] fi = typeof(ManagedDataOffsets).GetFields(BindingFlags.Static | BindingFlags.Public);
            for (int i = 0; i < fi.Length; i++)
            {
                fi[i].SetValue(null, -(i * IntPtr.Size) - IntPtr.Size);
            }

            size = fi.Length * IntPtr.Size;
        }

        public static readonly int ob_data;
        public static readonly int ob_dict;

        private static int BaseOffset(IntPtr type)
        {
            Debug.Assert(type != IntPtr.Zero);
            int typeSize = Marshal.ReadInt32(type, TypeOffset.tp_basicsize);
            Debug.Assert(typeSize > 0 && typeSize 

Web Proxy Viewer  |  New URL  |  Original Page