[python3/f14/master] Merge changes from a subsequent revision that fixes lone surrogate detection compilation with wide u

Toshio くらとみ toshio at fedoraproject.org
Sun Aug 22 14:45:02 UTC 2010


commit f8668169b663233bea08f502ab3957e78c7a9777
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date:   Sun Aug 22 10:43:31 2010 -0400

    Merge changes from a subsequent revision that fixes lone surrogate
    detection compilation with wide unicode builds.

 ...385-lone-surrogate-and-utf8-error-handler.patch |   16 ++++++++++++++--
 python3.spec                                       |    4 ++--
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/python3-r80382-lone-surrogate-and-utf8-error-handler.patch b/python3-r80382-r80385-lone-surrogate-and-utf8-error-handler.patch
similarity index 95%
rename from python3-r80382-lone-surrogate-and-utf8-error-handler.patch
rename to python3-r80382-r80385-lone-surrogate-and-utf8-error-handler.patch
index 6287d7f..93420a8 100644
--- a/python3-r80382-lone-surrogate-and-utf8-error-handler.patch
+++ b/python3-r80382-r80385-lone-surrogate-and-utf8-error-handler.patch
@@ -15,7 +15,17 @@ Index: Python-3.1.2/Objects/unicodeobject.c
  /* Same for linebreaks */
  static unsigned char ascii_linebreak[] = {
      0, 0, 0, 0, 0, 0, 0, 0,
-@@ -2461,59 +2467,88 @@ PyUnicode_EncodeUTF8(const Py_UNICODE *s
+@@ -2453,67 +2459,98 @@ PyUnicode_EncodeUTF8(const Py_UNICODE *s
+     for (i = 0; i < size;) {
+         Py_UCS4 ch = s[i++];
+ 
+-        if (ch < 0x80)
++        if (ch < 0x80) {
+             /* Encode ASCII */
+             *p++ = (char) ch;
+ 
+-        else if (ch < 0x0800) {
++        } else if (ch < 0x0800) {
              /* Encode Latin-1 */
              *p++ = (char)(0xc0 | (ch >> 6));
              *p++ = (char)(0x80 | (ch & 0x3f));
@@ -50,6 +60,7 @@ Index: Python-3.1.2/Objects/unicodeobject.c
 +                *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
 +                *p++ = (char)(0x80 | (ch & 0x3f));
 +
++            } else {
  #endif
 -                if (ch >= 0xd800 && ch <= 0xdfff) {
 -                    Py_ssize_t newpos;
@@ -66,7 +77,6 @@ Index: Python-3.1.2/Objects/unicodeobject.c
 -                    if (!PyBytes_Check(rep)) {
 -                        PyErr_SetString(PyExc_TypeError, "error handler should have returned bytes");
 -                        Py_DECREF(rep);
-+            } else {
 +                Py_ssize_t newpos;
 +                PyObject *rep;
 +                Py_ssize_t repsize, k;
@@ -139,8 +149,10 @@ Index: Python-3.1.2/Objects/unicodeobject.c
 -                *p++ = (char)(0x80 | (ch & 0x3f));
 -                continue;
 +                Py_DECREF(rep);
++#ifndef Py_UNICODE_WIDE
              }
 -          encodeUCS4:
++#endif
 +        } else if (ch < 0x10000) {
 +            *p++ = (char)(0xe0 | (ch >> 12));
 +            *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
diff --git a/python3.spec b/python3.spec
index 9ec77d6..75f1203 100644
--- a/python3.spec
+++ b/python3.spec
@@ -227,7 +227,7 @@ Patch110: python-3.1.2-fix-expat-issue9054.patch
 # Fix encoding to utf8 when lone surrogates are present and error handler is
 # set to ignore, replace, or others that return a unicode str.
 # http://bugs.python.org/issue8092
-Patch111: python3-r80382-lone-surrogate-and-utf8-error-handler.patch
+Patch111: python3-r80382-r80385-lone-surrogate-and-utf8-error-handler.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: readline-devel, openssl-devel, gmp-devel
@@ -389,7 +389,7 @@ rm -r Modules/zlib || exit 1
 
 %patch110 -p0 -b .fix-expat-issue9054
 
-%patch111 -p0 -b .surrogate-utf8
+%patch111 -p1 -b .surrogate-utf8
 
 # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
 # are many differences between 2.6 and the Python 3 library.


More information about the scm-commits mailing list