Ejemplo n.º 1
0
        public static void SetWCharArrayRaw(_Array arr, object value)
        {
            MemoryView view = value as MemoryView;

            if ((object)view != null)
            {
                string strVal = view.tobytes().MakeString();
                if (strVal.Length > arr.__len__())
                {
                    throw PythonOps.ValueError("string too long");
                }
                value = strVal;
            }

            arr.NativeType.SetValue(arr._memHolder, 0, value);
        }
Ejemplo n.º 2
0
        public static void SetWCharArrayRaw(_Array arr, object value)
        {
            PythonBuffer buf = value as PythonBuffer;

            if (buf != null && (buf._object is string || buf._object is Bytes))
            {
                value = buf.ToString();
            }

            MemoryView view = value as MemoryView;

            if ((object)view != null)
            {
                string strVal = view.tobytes().ToString();
                if (strVal.Length > arr.__len__())
                {
                    throw PythonOps.ValueError("string too long");
                }
                value = strVal;
            }

            arr.NativeType.SetValue(arr._memHolder, 0, value);
        }
Ejemplo n.º 3
0
 public static Bytes hexlify(MemoryView data)
 {
     return(hexlify(data.tobytes()));
 }
Ejemplo n.º 4
0
 public static Bytes a2b_uu(CodeContext /*!*/ context, [NotNull] MemoryView data)
 => a2b_uu_impl(context, data.tobytes());