mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
fix test_float regression and 64-bit size mismatch issue
This commit is contained in:
parent
955b64c031
commit
964e02a901
1 changed files with 16 additions and 2 deletions
|
|
@ -1486,14 +1486,28 @@ init_struct(void)
|
||||||
other = lilendian_table;
|
other = lilendian_table;
|
||||||
else
|
else
|
||||||
other = bigendian_table;
|
other = bigendian_table;
|
||||||
|
/* Scan through the native table, find a matching
|
||||||
|
entry in the endian table and swap in the
|
||||||
|
native implementations whenever possible
|
||||||
|
(64-bit platforms may not have "standard" sizes) */
|
||||||
while (native->format != '\0' && other->format != '\0') {
|
while (native->format != '\0' && other->format != '\0') {
|
||||||
ptr = other;
|
ptr = other;
|
||||||
while (ptr->format != '\0') {
|
while (ptr->format != '\0') {
|
||||||
if (ptr->format == native->format) {
|
if (ptr->format == native->format) {
|
||||||
ptr->pack = native->pack;
|
/* Match faster when formats are
|
||||||
ptr->unpack = native->unpack;
|
listed in the same order */
|
||||||
if (ptr == other)
|
if (ptr == other)
|
||||||
other++;
|
other++;
|
||||||
|
/* Only use the trick if the
|
||||||
|
size matches */
|
||||||
|
if (ptr->size != native->size)
|
||||||
|
break;
|
||||||
|
/* Skip float and double, could be
|
||||||
|
"unknown" float format */
|
||||||
|
if (ptr->format == 'd' || ptr->format == 'f')
|
||||||
|
break;
|
||||||
|
ptr->pack = native->pack;
|
||||||
|
ptr->unpack = native->unpack;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue