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.
diff --git a/Misc/unicode.txt b/Misc/unicode.txt
index fc1f2c5..ce74c05 100644
--- a/Misc/unicode.txt
+++ b/Misc/unicode.txt
@@ -740,8 +740,8 @@
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 @@
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 @@
return NULL;
}
str = PyString_FromStringAndSize(buffer, buffer_len);
- free(buffer);
+ PyMem_Free(buffer);
return str;
}
@@ -807,7 +808,7 @@
return NULL;
}
str = PyString_FromString(buffer);
- free(buffer);
+ PyMem_Free(buffer);
return str;
}