Author: Matti Picus <[email protected]> Branch: buffer-interface Changeset: r86896:59716a90a56a Date: 2016-09-05 23:53 +0300 http://bitbucket.org/pypy/pypy/changeset/59716a90a56a/
Log: try to update documentation diff --git a/pypy/module/cpyext/bytesobject.py b/pypy/module/cpyext/bytesobject.py --- a/pypy/module/cpyext/bytesobject.py +++ b/pypy/module/cpyext/bytesobject.py @@ -29,19 +29,17 @@ ## Solution ## -------- ## -## PyBytesObject contains two additional members: the ob_size and a pointer to a -## char ob_sval; it may be NULL. +## PyBytesObject contains two additional members: the ob_size and an array +## char ob_sval which holds a \x0 terminated string. ## ## - A string allocated by pypy will be converted into a PyBytesObject with a -## NULL buffer. The first time PyString_AsString() is called, memory is -## allocated (with flavor='raw') and content is copied. +## buffer holding \x0. The first time PyString_AsString() is called, the +## PyStringObject is reallocated, and the string copied into the buffer. The +## ob_size reflects the length of the string. ## ## - A string allocated with PyString_FromStringAndSize(NULL, size) will ## allocate a PyBytesObject structure, and a buffer with the specified -## size+1, but the reference won't be stored in the global map; there is no -## corresponding object in pypy. When from_ref() or Py_INCREF() is called, -## the pypy string is created, and added to the global map of tracked -## objects. The buffer is then supposed to be immutable. +## size+1, as part of the object. The buffer is then supposed to be immutable. ## ##- A buffer obtained from PyString_AS_STRING() could be mutable iff ## there is no corresponding pypy object for the string _______________________________________________ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
