[Python-Dev] _PyUnicode_CheckConsistency() too strict?

Ethan Furman ethan at stoneleaf.us
Mon Feb 3 19:08:06 CET 2014


On 02/03/2014 09:52 AM, Guido van Rossum wrote:
> Can we provide a convenience API (or even a few lines of code one could copy+paste) that determines if a particular
> 8-bit string should  have max-char equal to 127 or 255?

Isn't that what this is?

============================================================
  PyObject* PyUnicode_FromKindAndData(
         int kind, const void *buffer, Py_ssize_t size)

     Create a new Unicode object with the given kind (possible
     values are PyUnicode_1BYTE_KIND etc., as returned by
     PyUnicode_KIND()). The buffer must point to an array of
     size units of 1, 2 or 4 bytes per character, as given by
     the kind.
============================================================

--
~Ethan~


More information about the Python-Dev mailing list