Skip to content

Commit 871829c

Browse files
committed
Convert mpz to heap type
1 parent 3ded92b commit 871829c

9 files changed

Lines changed: 452 additions & 319 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-24.04]
16-
python-version: [3.9, '3.10', pypy3.11, graalpy-24.2,
17-
3.11, 3.12, 3.13, 3.13t, 3.14, 3.14t]
16+
python-version: [pypy3.11-nightly, graalpy-24.2, 3.11, 3.12,
17+
3.13, 3.13t, 3.14, 3.14t]
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
PYTEST_ADDOPTS: --verbose

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fail-fast: true
1212
matrix:
1313
os: [ubuntu-24.04]
14-
python-version: [pypy3.11, "3.x", 3.14]
14+
python-version: [pypy3.11-nightly, "3.x", 3.14]
1515
steps:
1616
- uses: actions/checkout@v4
1717
with:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This module can be used as a gmpy2/python-flint replacement to provide
88
CPython-compatible integer (mpz) type. It includes few functions (factorial,
99
gcd and isqrt), compatible with the stdlib's module math.
1010

11-
It requires Python 3.9 or later versions and has been tested with CPython 3.9
11+
It requires Python 3.11 or later versions and has been tested with CPython 3.11
1212
through 3.14, for PyPy 3.11 and for GraalPy 24.2. Free-threading builds of the
1313
CPython are supported.
1414

fmt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ format_long_internal(MPZ_Object *value, const InternalFormatSpec *format)
952952
Py_ssize_t prefix = 0;
953953
NumberFieldWidths spec;
954954
int32_t x = -1;
955+
gmp_state *state = PyType_GetModuleState(Py_TYPE(value));
955956

956957
/* Locale settings, either from the actual locale or
957958
from a hard-code pseudo-locale */
@@ -1038,7 +1039,7 @@ format_long_internal(MPZ_Object *value, const InternalFormatSpec *format)
10381039
if (format->sign != '+' && format->sign != ' '
10391040
&& format->width == -1 && format->type != 'n'
10401041
&& !format->thousands_separators
1041-
&& MPZ_CheckExact(value))
1042+
&& MPZ_CheckExact(state, value))
10421043
{
10431044
/* Fast path */
10441045
return MPZ_to_str(value, base, format->alternate ? OPT_PREFIX : 0);

0 commit comments

Comments
 (0)