summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-05-11 13:59:37 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-05-11 13:59:37 (GMT)
commit7ce35a1816254b82ac4e3196df9b17bc9585997f (patch)
tree261581c8a7b0ee66a9148ec6e1baebed4f312f7a /Objects
parent3f5228d402474bf629891f906a80050d4098e1a0 (diff)
parent8b0e98426dd0e1fde93715256413bc707759db6f (diff)
downloadcpython-7ce35a1816254b82ac4e3196df9b17bc9585997f.zip
cpython-7ce35a1816254b82ac4e3196df9b17bc9585997f.tar.gz
cpython-7ce35a1816254b82ac4e3196df9b17bc9585997f.tar.bz2
Issue #17237: Fix crash in the ASCII decoder on m68k.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c5e50eb..9f57cdb 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4647,6 +4647,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)) {
@@ -4672,6 +4680,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
for an explanation. */