bpo-36333: Clarify fileutils.h documentation by vstinner · Pull Request #12406 · python/cpython
To me, length is the number of characters not including the trailing NUL character, and size is the number of characters including the trailing NUL character.
Oh. I tried but I failed to find a clear "definition" of "length" vs "size". Usually for me, on a wchar_t* string, size means the number of bytes: wcslen(str)*sizeof(wchar_t), whereas length means the number of characters excluding trainling NUL: wcslen(str).
In fact, I don't know any exact term for "length including trailing NUL". That's why I added doc to be more explicit about that.
Since this PR, I also modified getpath.c to handle differently buffer length/size. I added functions which take Py_ARRAY_LENGTH(buffer) to decide if an operation will overflow a string or not.