title: PyUnicode_FromStringAndSize: Very terse documentation
body: <p>Apologies if this is a stupid question which I suspect it may well be. I'm a Python user with little experience in C.</p>
  <p>According to the <a href="https://docs.python.org/3/c-api/unicode.html#creating-and-accessing-unicode-strings" rel="nofollow noreferrer">official Python docs (v3.10.6)</a>:</p>
  <blockquote>
  <p>PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
  Return value: New reference. Part of the Stable ABI.</p>
  <blockquote>
  <p>Create a Unicode object from the char buffer u. The bytes will be interpreted as being UTF-8 encoded. The buffer is copied into the new object. If the buffer is not NULL, the return value might be a shared object, i.e. modification of the data is not allowed. [...]</p>
  </blockquote>
  </blockquote>
  <p>which has me slightly confused.</p>
  <p>It says the data i.e. the buffer u is copied.
  But then it says the data may be shared which seems to contradict the first statement.</p>
  <p>My Question is:</p>
  <p>What exactly do they mean? That the newly allocated copy of the data is shared? If so who with?</p>
  <p>Also, coming from Python: Why do they make a point of warning against tampering with the data anyway? Is changing a Python-immutable object something routinely done in C?</p>
  <p>Ultimately, all I need to know is what to do with u: Can/should I free it or has Python taken ownership?</p>