mirror of
https://github.com/python/cpython.git
synced 2025-12-09 10:37:17 +00:00
Marc-Andre Lemburg:
The attached patch set includes a workaround to get Python with Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause is a bug in the BSDI wchar.h header file) and Python interfaces for the MBCS codec donated by Mark Hammond. Also included are some minor corrections w/r to the docs of the new "es" and "es#" parser markers (use PyMem_Free() instead of free(); thanks to Mark Hammond for finding these). The unicodedata tests are now in a separate file (test_unicodedata.py) to avoid problems if the module cannot be found.
This commit is contained in:
parent
66d4513975
commit
24bdb0474f
9 changed files with 116 additions and 56 deletions
|
|
@ -740,8 +740,8 @@ These markers are used by the PyArg_ParseTuple() APIs:
|
|||
On output, a buffer of the needed size is allocated and
|
||||
returned through *buffer as NULL-terminated string.
|
||||
The encoded may not contain embedded NULL characters.
|
||||
The caller is responsible for free()ing the allocated *buffer
|
||||
after usage.
|
||||
The caller is responsible for calling PyMem_Free()
|
||||
to free the allocated *buffer after usage.
|
||||
|
||||
"es#":
|
||||
Takes three parameters: encoding (const char *),
|
||||
|
|
@ -755,8 +755,9 @@ These markers are used by the PyArg_ParseTuple() APIs:
|
|||
|
||||
If *buffer is NULL, a buffer of the needed size is
|
||||
allocated and output copied into it. *buffer is then
|
||||
updated to point to the allocated memory area. The caller
|
||||
is responsible for free()ing *buffer after usage.
|
||||
updated to point to the allocated memory area.
|
||||
The caller is responsible for calling PyMem_Free()
|
||||
to free the allocated *buffer after usage.
|
||||
|
||||
In both cases *buffer_len is updated to the number of
|
||||
characters written (excluding the trailing NULL-byte).
|
||||
|
|
@ -784,7 +785,7 @@ Using "es#" with auto-allocation:
|
|||
return NULL;
|
||||
}
|
||||
str = PyString_FromStringAndSize(buffer, buffer_len);
|
||||
free(buffer);
|
||||
PyMem_Free(buffer);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
@ -807,7 +808,7 @@ Using "es" with auto-allocation returning a NULL-terminated string:
|
|||
return NULL;
|
||||
}
|
||||
str = PyString_FromString(buffer);
|
||||
free(buffer);
|
||||
PyMem_Free(buffer);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue