Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 compatibility #105

Merged
merged 1 commit into from
Jul 21, 2023
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
9 changes: 1 addition & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,16 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
cibw_arch: ["auto64", "aarch64", "universal2"]
cibw_python:
- "cp36-*"
- "cp37-*"
- "cp38-*"
- "cp39-*"
- "cp310-*"
- "cp311-*"
- "cp312-*"
exclude:
- os: ubuntu-latest
cibw_arch: universal2
- os: macos-latest
cibw_arch: aarch64
- os: macos-latest
cibw_python: "cp36-*"
cibw_arch: universal2
- os: macos-latest
cibw_python: "cp37-*"
cibw_arch: universal2
- os: windows-latest
cibw_arch: universal2
- os: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.0-beta.4"]
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [x64, x86]
exclude:
Expand Down
18 changes: 9 additions & 9 deletions immutables/_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,10 @@ _map_dump_format(_PyUnicodeWriter *writer, const char *format, ...)
int ret;

va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
#if PY_VERSION_HEX < 0x030C00A1 && !defined(HAVE_STDARG_PROTOTYPES)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could probably just only have the 2 arg format

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People seem to be building immutables on odd platforms, so I'm reluctant to drop this.

va_start(vargs);
#else
va_start(vargs, format);
#endif
msg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
Expand Down Expand Up @@ -1247,7 +1247,7 @@ map_node_bitmap_dealloc(MapNode_Bitmap *self)
Py_ssize_t i;

PyObject_GC_UnTrack(self);
Py_TRASHCAN_SAFE_BEGIN(self)
Py_TRASHCAN_BEGIN(self, map_node_bitmap_dealloc)

if (len > 0) {
i = len;
Expand All @@ -1257,7 +1257,7 @@ map_node_bitmap_dealloc(MapNode_Bitmap *self)
}

Py_TYPE(self)->tp_free((PyObject *)self);
Py_TRASHCAN_SAFE_END(self)
Py_TRASHCAN_END
}

static int
Expand Down Expand Up @@ -1664,7 +1664,7 @@ map_node_collision_dealloc(MapNode_Collision *self)
Py_ssize_t len = Py_SIZE(self);

PyObject_GC_UnTrack(self);
Py_TRASHCAN_SAFE_BEGIN(self)
Py_TRASHCAN_BEGIN(self, map_node_collision_dealloc)

if (len > 0) {

Expand All @@ -1674,7 +1674,7 @@ map_node_collision_dealloc(MapNode_Collision *self)
}

Py_TYPE(self)->tp_free((PyObject *)self);
Py_TRASHCAN_SAFE_END(self)
Py_TRASHCAN_END
}

static int
Expand Down Expand Up @@ -2083,14 +2083,14 @@ map_node_array_dealloc(MapNode_Array *self)
Py_ssize_t i;

PyObject_GC_UnTrack(self);
Py_TRASHCAN_SAFE_BEGIN(self)
Py_TRASHCAN_BEGIN(self, map_node_array_dealloc)

for (i = 0; i < HAMT_ARRAY_NODE_SIZE; i++) {
Py_XDECREF(self->a_array[i]);
}

Py_TYPE(self)->tp_free((PyObject *)self);
Py_TRASHCAN_SAFE_END(self)
Py_TRASHCAN_END
}

static int
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# pycodestyle is a dependency of flake8, but it must be frozen because
# their combination breaks too often
# (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
'flake8~=5.0.4',
'pycodestyle~=2.9.1',
'mypy==0.971',
'pytest~=6.2.4',
'flake8~=5.0',
'pycodestyle~=2.9',
'mypy~=1.4',
'pytest~=7.4',
]

EXTRA_DEPENDENCIES = {
Expand Down Expand Up @@ -65,16 +65,16 @@
version=VERSION,
description='Immutable Collections',
long_description=readme,
python_requires='>=3.6',
python_requires='>=3.7',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be 3.8, since 3.7 was also dropped.

classifiers=[
'License :: OSI Approved :: Apache Software License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
Expand Down