Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ce35a1

Browse files
committed
Issue #17237: Fix crash in the ASCII decoder on m68k.
2 parents 3f5228d + 8b0e984 commit 7ce35a1

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ What's New in Python 3.4.0 Alpha 1?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #17237: Fix crash in the ASCII decoder on m68k.
14+
1315
- Issue #17927: Frame objects kept arguments alive if they had been
1416
copied into a cell, even if the cell was cleared.
1517

Objects/unicodeobject.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4647,6 +4647,14 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
46474647
const char *p = start;
46484648
const char *aligned_end = (const char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
46494649

4650+
/*
4651+
* Issue #17237: m68k is a bit different from most architectures in
4652+
* that objects do not use "natural alignment" - for example, int and
4653+
* long are only aligned at 2-byte boundaries. Therefore the assert()
4654+
* won't work; also, tests have shown that skipping the "optimised
4655+
* version" will even speed up m68k.
4656+
*/
4657+
#if !defined(__m68k__)
46504658
#if SIZEOF_LONG <= SIZEOF_VOID_P
46514659
assert(_Py_IS_ALIGNED(dest, SIZEOF_LONG));
46524660
if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
@@ -4671,6 +4679,7 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
46714679
}
46724680
return p - start;
46734681
}
4682+
#endif
46744683
#endif
46754684
while (p < end) {
46764685
/* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h

0 commit comments

Comments
 (0)