[Python-checkins] cpython (3.3): Issue #17237: Fix crash in the ASCII decoder on m68k.
antoine.pitrou
python-checkins at python.org
Sat May 11 15:59:52 CEST 2013
http://hg.python.org/cpython/rev/0f8022ac88ad
changeset: 83709:0f8022ac88ad
branch: 3.3
parent: 83704:3b935ac07f65
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat May 11 15:58:34 2013 +0200
summary:
Issue #17237: Fix crash in the ASCII decoder on m68k.
files:
Misc/NEWS | 2 ++
Objects/unicodeobject.c | 9 +++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@
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.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4661,6 +4661,14 @@
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)) {
@@ -4686,6 +4694,7 @@
return p - start;
}
#endif
+#endif
while (p < end) {
/* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h
for an explanation. */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list