Skip to content

Commit 6c5f096

Browse files
committed
Add support for Python 3.10
Fixs #236 and fixes #237 Locally, the python.org installer for macOS 3.10.0b1 is crashing on the test suite, but versions I've built myself are fine. I'm still trying to figure out what's going on.
1 parent ef08260 commit 6c5f096

5 files changed

Lines changed: 26 additions & 7 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ${{ matrix.os }}
2424
strategy:
2525
matrix:
26-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
26+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0-beta.1]
2727
os: [ubuntu-latest, macos-latest]
2828
steps:
2929
- uses: actions/checkout@v2
@@ -95,10 +95,17 @@ jobs:
9595
#run: |
9696
# docker run --rm --privileged multiarch/qemu-user-static:register --reset
9797
- name: Build and test greenlet
98+
if: matrix.image == 'manylinux2010_x86_64'
9899
# An alternate way to do this is to run the container directly with a uses:
99100
# and then the script runs inside it. That may work better with caching.
100101
# See https://github.com/pyca/bcrypt/blob/f6b5ee2eda76d077c531362ac65e16f045cf1f29/.github/workflows/wheel-builder.yml
101-
# The 2010 image is the last one that comes with Python 2.7.
102+
# The 2010 image is the last one that comes with Python 2.7,
103+
# and only up through the tag 2021-02-06-3d322a5
104+
env:
105+
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}:2021-02-06-3d322a5
106+
run: bash ./make-manylinux
107+
- name: Build and test greenlet (other)
108+
if: matrix.image != 'manylinux2010_x86_64'
102109
env:
103110
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}
104111
run: bash ./make-manylinux

‎CHANGES.rst‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Changes
33
=========
44

5-
1.0.1 (unreleased)
5+
1.1.0 (unreleased)
66
==================
77

8-
- Nothing changed yet.
8+
- Add support for Python 3.10. Pre-built binary wheels are not
9+
currently available for 3.10.
910

1011

1112
1.0.0 (2021-01-13)

‎setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def get_greenlet_version():
138138
'Programming Language :: Python :: 3.7',
139139
'Programming Language :: Python :: 3.8',
140140
'Programming Language :: Python :: 3.9',
141+
'Programming Language :: Python :: 3.10',
141142
'Operating System :: OS Independent',
142143
'Topic :: Software Development :: Libraries :: Python Modules'
143144
],

‎src/greenlet/greenlet.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ extern PyTypeObject PyGreenlet_Type;
9696
# define GREENLET_PY37 0
9797
#endif
9898

99+
#if PY_VERSION_HEX >= 0x30A00B1
100+
/*
101+
Python 3.10 beta 1 changed tstate->use_tracing to a nested cframe member.
102+
See https://github.com/python/cpython/pull/25276
103+
*/
104+
#define TSTATE_USE_TRACING(tstate) (tstate->cframe->use_tracing)
105+
#else
106+
#define TSTATE_USE_TRACING(tstate) (tstate->use_tracing)
107+
#endif
108+
99109
#ifndef Py_SET_REFCNT
100110
/* Py_REFCNT and Py_SIZE macros are converted to functions
101111
https://bugs.python.org/issue39573 */
@@ -567,10 +577,10 @@ g_calltrace(PyObject* tracefunc, PyObject* event, PyGreenlet* origin,
567577
PyErr_Fetch(&exc_type, &exc_val, &exc_tb);
568578
tstate = PyThreadState_GET();
569579
tstate->tracing++;
570-
tstate->use_tracing = 0;
580+
TSTATE_USE_TRACING(tstate) = 0;
571581
retval = PyObject_CallFunction(tracefunc, "O(OO)", event, origin, target);
572582
tstate->tracing--;
573-
tstate->use_tracing =
583+
TSTATE_USE_TRACING(tstate) =
574584
(tstate->tracing <= 0 &&
575585
((tstate->c_tracefunc != NULL) || (tstate->c_profilefunc != NULL)));
576586
if (retval == NULL) {

‎tox.ini‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py27,py35,py36,py37,py38,py39,docs
3+
py27,py35,py36,py37,py38,py39,py310,docs
44

55
[testenv]
66
commands =

0 commit comments

Comments
 (0)