Skip to content

Commit b67a302

Browse files
committed
Cleanup gmp_info
1 parent 181f4e8 commit b67a302

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,13 +3370,12 @@ The attributes are read only.");
33703370

33713371
static PyStructSequence_Field gmp_info_fields[] = {
33723372
{"bits_per_limb", "size of a limb in bits"},
3373-
{"nail_bits", "number of bits left unused at the top of each limb"},
33743373
{"sizeof_limb", "size in bytes of the C type used to represent a limb"},
33753374
{"version", "the GNU GMP version"},
33763375
{NULL}};
33773376

33783377
static PyStructSequence_Desc gmp_info_desc = {
3379-
"gmp.gmplib_info", gmp_info__doc__, gmp_info_fields, 4};
3378+
"gmp.gmplib_info", gmp_info__doc__, gmp_info_fields, 3};
33803379

33813380
PyMODINIT_FUNC
33823381
PyInit_gmp(void)
@@ -3420,9 +3419,8 @@ PyInit_gmp(void)
34203419
/* LCOV_EXCL_STOP */
34213420
}
34223421
PyStructSequence_SET_ITEM(gmp_info, 0, PyLong_FromLong(GMP_LIMB_BITS));
3423-
PyStructSequence_SET_ITEM(gmp_info, 1, PyLong_FromLong(GMP_NAIL_BITS));
3424-
PyStructSequence_SET_ITEM(gmp_info, 2, PyLong_FromLong(sizeof(mp_limb_t)));
3425-
PyStructSequence_SET_ITEM(gmp_info, 3, PyUnicode_FromString(gmp_version));
3422+
PyStructSequence_SET_ITEM(gmp_info, 1, PyLong_FromLong(sizeof(mp_limb_t)));
3423+
PyStructSequence_SET_ITEM(gmp_info, 2, PyUnicode_FromString(gmp_version));
34263424
if (PyErr_Occurred()) {
34273425
/* LCOV_EXCL_START */
34283426
Py_DECREF(gmp_info);

tests/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
def pytest_report_header(config):
1515
print(f"""
16-
The GNU GMP version: {gmp.gmp_info[3]}
16+
The GNU GMP version: {gmp.gmp_info[2]}
1717
Bits per limb: {gmp.gmp_info[0]}
18-
Nails bits: {gmp.gmp_info[1]}
19-
Size of a limb: {gmp.gmp_info[2]}
18+
Size of a limb: {gmp.gmp_info[1]}
2019
""")

tests/test_mpz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def test___round__interface():
676676
@pytest.mark.skipif(platform.python_implementation() == "PyPy",
677677
reason="sys.getsizeof raises TypeError")
678678
def test___sizeof__():
679-
limb_size = gmp_info[2]
679+
limb_size = gmp_info[1]
680680
ms = [mpz(1<<i*(8*limb_size)) for i in range(3)]
681681
sz = sys.getsizeof(ms[1]) - sys.getsizeof(ms[0])
682682
assert sys.getsizeof(ms[2]) - sys.getsizeof(ms[1]) == sz

0 commit comments

Comments
 (0)