Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.13t"
# CPython 3.14 final is scheduled for October 2025:
# https://peps.python.org/pep-0719/
- "3.14"
- "3.14t"

# PyPy versions:
# - https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md
Expand Down Expand Up @@ -68,6 +70,8 @@ jobs:
python: "3.12"
- os: windows-latest
python: "3.13"
- os: windows-latest
python: "3.13t"

# macOS
# Python 3.9 is the oldest version available on macOS/arm64.
Expand All @@ -81,6 +85,8 @@ jobs:
python: "3.12"
- os: macos-latest
python: "3.13"
- os: macos-latest
python: "3.13t"

# Ubuntu: test deadsnakes Python versions which are not supported by
# GHA python-versions.
Expand Down
29 changes: 24 additions & 5 deletions tests/test_pythoncapi_compat_cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,29 +1432,48 @@ test_long_api(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
PyLongWriter *writer;
static PyLongExport long_export;

writer = PyLongWriter_Create(1, 1, (void**)&digits);
writer = PyLongWriter_Create(1, 1, (void **)&digits);
if (writer == NULL) {
return NULL;
}
PyLongWriter_Discard(writer);

writer = PyLongWriter_Create(1, 1, (void**)&digits);
writer = PyLongWriter_Create(1, 1, (void **)&digits);
if (writer == NULL) {
return NULL;
}
digits[0] = 123;
obj = PyLongWriter_Finish(writer);
if (obj == NULL) {
return NULL;
}

check_int(obj, -123);
PyLong_Export(obj, &long_export);
if (PyLong_Export(obj, &long_export) < 0) {
return NULL;
}
assert(long_export.value == -123);
assert(long_export.digits == NULL);
PyLong_FreeExport(&long_export);
Py_DECREF(obj);

writer = PyLongWriter_Create(0, 5, (void**)&digits);
writer = PyLongWriter_Create(0, 5, (void **)&digits);
if (writer == NULL) {
return NULL;
}
digits[0] = 1;
digits[1] = 0;
digits[2] = 0;
digits[3] = 0;
digits[4] = 1;
obj = PyLongWriter_Finish(writer);
if (obj == NULL) {
return NULL;
}

PyLong_Export(obj, &long_export);
if (PyLong_Export(obj, &long_export) < 0) {
return NULL;
}
assert(long_export.value == 0);
digits = (digit*)long_export.digits;
assert(digits[0] == 1);
Expand Down
Loading