]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17237: Fix crash in the ASCII decoder on m68k.
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 11 May 2013 13:58:34 +0000 (15:58 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 11 May 2013 13:58:34 +0000 (15:58 +0200)
Misc/NEWS
Objects/unicodeobject.c

index 4d1ee47fd49993537fbd51260f02de3979ca7455..bccd7f66e63e6d3cf4bed21efd5ab9b58c9f3cac 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 3.3.2?
 Core and Builtins
 -----------------
 
+- Issue #17237: Fix crash in the ASCII decoder on m68k.
+
 - Issue #17408: Avoid using an obsolete instance of the copyreg module when
   the interpreter is shutdown and then started again.
 
index c21e80c99d2e7878e3698c16d8a13a6d0578dee3..8d6cda50ba32c5c0a3bca0469bfb9d9e0d7eda02 100644 (file)
@@ -4661,6 +4661,14 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
     const char *p = start;
     const char *aligned_end = (const char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
 
+    /*
+     * Issue #17237: m68k is a bit different from most architectures in
+     * that objects do not use "natural alignment" - for example, int and
+     * long are only aligned at 2-byte boundaries.  Therefore the assert()
+     * won't work; also, tests have shown that skipping the "optimised
+     * version" will even speed up m68k.
+     */
+#if !defined(__m68k__)
 #if SIZEOF_LONG <= SIZEOF_VOID_P
     assert(_Py_IS_ALIGNED(dest, SIZEOF_LONG));
     if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
@@ -4685,6 +4693,7 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
         }
         return p - start;
     }
+#endif
 #endif
     while (p < end) {
         /* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h