Skip to content

Commit cc05a9a

Browse files
committed
address review
1 parent e0455b7 commit cc05a9a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pythoncapi_compat.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,13 +1762,6 @@ typedef struct PyLongLayout {
17621762
int8_t digit_endianness;
17631763
} PyLongLayout;
17641764

1765-
static const PyLongLayout PyLong_LAYOUT = {
1766-
PyLong_SHIFT,
1767-
sizeof(digit),
1768-
-1, // least significant first
1769-
PY_LITTLE_ENDIAN ? -1 : 1,
1770-
};
1771-
17721765
typedef struct PyLongExport {
17731766
int64_t value;
17741767
uint8_t negative;
@@ -1782,6 +1775,13 @@ typedef struct PyLongWriter PyLongWriter;
17821775
static inline const PyLongLayout*
17831776
PyLong_GetNativeLayout(void)
17841777
{
1778+
static const PyLongLayout PyLong_LAYOUT = {
1779+
PyLong_SHIFT,
1780+
sizeof(digit),
1781+
-1, // least significant first
1782+
PY_LITTLE_ENDIAN ? -1 : 1,
1783+
};
1784+
17851785
return &PyLong_LAYOUT;
17861786
}
17871787

tests/test_pythoncapi_compat_cext.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ test_long_api(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
14391439
digits[0] = 123;
14401440
obj = PyLongWriter_Finish(writer);
14411441

1442+
check_int(obj, -123);
14421443
PyLong_Export(obj, &long_export);
14431444
assert(long_export.value == -123);
14441445
assert(long_export.digits == NULL);

0 commit comments

Comments
 (0)