From 15f494d8ef787c1c6466938a6c0552bdb3c3d2da Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 15 Jul 2011 01:13:24 +0200 Subject: Py_BuildValue("C") supports non-BMP characters on narrow build Py_BuildValue("C") doesn't have to check the code point, PyUnicode_FromOrdinal() checks its input and now supports non-BMP characters (range U+10000-U+10FFFF). --- Python/modsupport.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Python/modsupport.c') diff --git a/Python/modsupport.c b/Python/modsupport.c index 85b0d66358..08f5065883 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -292,11 +292,6 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) case 'C': { int i = va_arg(*p_va, int); - if (i < 0 || i > PyUnicode_GetMax()) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000)"); - return NULL; - } return PyUnicode_FromOrdinal(i); } -- cgit v1.2.1 From c9c3ace041fe6342cf1c26f971a8d1e338242248 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 29 Sep 2011 04:01:43 +0200 Subject: modsupport.c reuses Py_UNICODE_strlen() --- Python/modsupport.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'Python/modsupport.c') diff --git a/Python/modsupport.c b/Python/modsupport.c index 08f5065883..428914f378 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -148,15 +148,6 @@ do_mklist(const char **p_format, va_list *p_va, int endchar, int n, int flags) return v; } -static int -_ustrlen(Py_UNICODE *u) -{ - int i = 0; - Py_UNICODE *v = u; - while (*v != 0) { i++; v++; } - return i; -} - static PyObject * do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) { @@ -269,7 +260,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) } else { if (n < 0) - n = _ustrlen(u); + n = Py_UNICODE_strlen(u); v = PyUnicode_FromUnicode(u, n); } return v; -- cgit v1.2.1