Skip to content

Commit f134833

Browse files
committed
Add support for free-threaded Python.
Fix #1680.
1 parent ce370b2 commit f134833

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
- "3.12"
6363
- "3.13"
6464
- "3.14"
65+
- "3.14t"
6566
- "pypy-3.10"
6667
is_main:
6768
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

docs/project/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ New features
4545

4646
* Validated compatibility with Python 3.14.
4747

48+
* Added support for free-threaded Python.
49+
4850
Improvements
4951
............
5052

src/websockets/speedups.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,12 @@ static struct PyModuleDef speedups_module = {
218218
PyMODINIT_FUNC
219219
PyInit_speedups(void)
220220
{
221-
return PyModule_Create(&speedups_module);
221+
PyObject *m = PyModule_Create(&speedups_module);
222+
if (m == NULL) {
223+
return NULL;
224+
}
225+
#ifdef Py_GIL_DISABLED
226+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
227+
#endif
228+
return m;
222229
}

0 commit comments

Comments
 (0)