Exemple #1
0
 /// Create a PyObject from a string.
 public static PyStr FromString(string value)
 {
     PyStr result;
     unsafe
     {
         var rawResult = CPython.PyUnicode_FromString(value);
         if (rawResult == null) throw new NullReferenceException("Failed to create PyObject from string.");
         result = new PyStr(rawResult);
     }
     return result;
 }
Exemple #2
0
        /// Create a PyObject from a string.
        public static PyStr FromString(string value)
        {
            PyStr result;

            unsafe
            {
                var rawResult = CPython.PyUnicode_FromString(value);
                if (rawResult == null)
                {
                    throw new NullReferenceException("Failed to create PyObject from string.");
                }
                result = new PyStr(rawResult);
            }
            return(result);
        }