Example #1
0
 /// <summary>
 /// Return the implied itemsize from format. On error, raise an exception and return -1.
 /// New in version 3.9.
 /// </summary>
 public static long SizeFromFormat(string format)
 {
     if (Runtime.PyVersion < new Version(3, 9))
     {
         throw new NotSupportedException("SizeFromFormat requires at least Python 3.9");
     }
     return((long)Runtime.PyBuffer_SizeFromFormat(format));
 }
Example #2
0
        /// <summary>
        /// Return the implied itemsize from format. On error, raise an exception and return -1.
        /// New in version 3.9.
        /// </summary>
        public static long SizeFromFormat(string format)
        {
            if (Runtime.PyVersion < new Version(3, 9))
            {
                throw new NotSupportedException("SizeFromFormat requires at least Python 3.9");
            }
            nint result = Runtime.PyBuffer_SizeFromFormat(format);

            if (result == -1)
            {
                throw PythonException.ThrowLastAsClrException();
            }
            return(result);
        }