Commit d004fc81 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch 1494554: Update numeric properties to Unicode 4.1.

parent d1b6cd7b
......@@ -965,7 +965,7 @@ These APIs can be used for fast direct character conversions:
\end{cfuncdesc}
\begin{cfuncdesc}{double}{Py_UNICODE_TONUMERIC}{Py_UNICODE ch}
Return the character \var{ch} converted to a (positive) double.
Return the character \var{ch} converted to a double.
Return \code{-1.0} if this is not possible. This macro does not raise
exceptions.
\end{cfuncdesc}
......
......@@ -16,7 +16,7 @@ encoding = 'utf-8'
class UnicodeMethodsTest(unittest.TestCase):
# update this, if the database changes
expectedchecksum = 'a6555cd209d960dcfa17bfdce0c96d91cfa9a9ba'
expectedchecksum = 'c198ed264497f108434b3f576d4107237221cc8a'
def test_method_checksum(self):
h = hashlib.sha1()
......@@ -75,7 +75,7 @@ class UnicodeDatabaseTest(unittest.TestCase):
class UnicodeFunctionsTest(UnicodeDatabaseTest):
# update this, if the database changes
expectedchecksum = 'b45b79f3203ee1a896d9b5655484adaff5d4964b'
expectedchecksum = '4e389f97e9f88b8b7ab743121fd643089116f9f2'
def test_function_checksum(self):
data = []
......
......@@ -12,6 +12,9 @@ What's New in Python 2.5 alpha 3?
Core and builtins
-----------------
- Patch #1494554: Update unicodedata.numeric and unicode.isnumeric to
Unicode 4.1.
- Patch #921466: sys.path_importer_cache is now used to cache valid and
invalid file paths for the built-in import machinery which leads to
fewer open calls on startup.
......
......@@ -209,7 +209,7 @@ unicodedata_numeric(PyObject *self, PyObject *args)
if (old->category_changed == 0) {
/* unassigned */
have_old = 1;
rc = -1;
rc = -1.0;
}
else if (old->decimal_changed != 0xFF) {
have_old = 1;
......@@ -219,7 +219,7 @@ unicodedata_numeric(PyObject *self, PyObject *args)
if (!have_old)
rc = Py_UNICODE_TONUMERIC(*PyUnicode_AS_UNICODE(v));
if (rc < 0) {
if (rc == -1.0) {
if (defobj == NULL) {
PyErr_SetString(PyExc_ValueError, "not a numeric character");
return NULL;
......
This diff is collapsed.
......@@ -2376,6 +2376,7 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
end = s + size;
while (s < end) {
*p = *(Py_UNICODE*)s;
memcpy(p, s, sizeof(Py_UNICODE));
/* We have to sanity check the raw data, otherwise doom looms for
some malformed UCS-4 data. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment