|
rdobuilder |
c7e8e2 |
From 0418516101d92159f74e69fdd1c29010db71c5cc Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Thomas A Caswell <tcaswell@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Fri, 4 Nov 2022 11:11:58 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 01/12] Fix #323: Support Python 3.12
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_cpython_compat.hpp | 6 ++++++
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_greenlet.hpp | 12 +++++++++++-
|
|
rdobuilder |
c7e8e2 |
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_cpython_compat.hpp b/src/greenlet/greenlet_cpython_compat.hpp
|
|
rdobuilder |
c7e8e2 |
index 3fd13ac..6210586 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_cpython_compat.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_cpython_compat.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -48,6 +48,12 @@ We have to save and restore this as well.
|
|
rdobuilder |
c7e8e2 |
# define GREENLET_USE_CFRAME 0
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
+#if PY_VERSION_HEX >= 0x30C0000
|
|
rdobuilder |
c7e8e2 |
+# define GREENLET_PY312 1
|
|
rdobuilder |
c7e8e2 |
+#else
|
|
rdobuilder |
c7e8e2 |
+# define GREENLET_PY312 0
|
|
rdobuilder |
c7e8e2 |
+#endif
|
|
rdobuilder |
c7e8e2 |
+
|
|
rdobuilder |
c7e8e2 |
#if PY_VERSION_HEX >= 0x30B00A4
|
|
rdobuilder |
c7e8e2 |
/*
|
|
rdobuilder |
c7e8e2 |
Greenlet won't compile on anything older than Python 3.11 alpha 4 (see
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
index cc02c5c..472902e 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -831,7 +831,11 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
this->use_tracing = tstate->cframe->use_tracing;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
+ #if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ #else
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
this->current_frame = tstate->cframe->current_frame;
|
|
rdobuilder |
c7e8e2 |
this->datastack_chunk = tstate->datastack_chunk;
|
|
rdobuilder |
c7e8e2 |
this->datastack_top = tstate->datastack_top;
|
|
rdobuilder |
c7e8e2 |
@@ -867,7 +871,11 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
tstate->cframe->use_tracing = this->use_tracing;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
+ #if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ tstate->py_recursion_remaining = tstate->py_recursion_limit - this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ #else
|
|
rdobuilder |
c7e8e2 |
tstate->recursion_remaining = tstate->recursion_limit - this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
tstate->cframe->current_frame = this->current_frame;
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_chunk = this->datastack_chunk;
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_top = this->datastack_top;
|
|
rdobuilder |
c7e8e2 |
@@ -895,7 +903,9 @@ void PythonState::will_switch_from(PyThreadState *const origin_tstate) G_NOEXCEP
|
|
rdobuilder |
c7e8e2 |
void PythonState::set_initial_state(const PyThreadState* const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
{
|
|
rdobuilder |
c7e8e2 |
this->_top_frame = nullptr;
|
|
rdobuilder |
c7e8e2 |
-#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
+#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+#elif GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 5c76aeda3709cafc8afe656ed7fa284369059d98 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Fri, 4 Nov 2022 12:53:37 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 02/12] Fix 3.12 testing
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 12 ++++++++++--
|
|
rdobuilder |
c7e8e2 |
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index 27c91e0..237a85b 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -25,15 +25,23 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
runs-on: ${{ matrix.os }}
|
|
rdobuilder |
c7e8e2 |
strategy:
|
|
rdobuilder |
c7e8e2 |
matrix:
|
|
rdobuilder |
c7e8e2 |
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
|
|
rdobuilder |
c7e8e2 |
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12.0~a1"]
|
|
rdobuilder |
c7e8e2 |
# Jan 2023: We have pinned back from ubuntu-latest (which is
|
|
rdobuilder |
c7e8e2 |
# now ubuntu 22.04) because older Python versions like
|
|
rdobuilder |
c7e8e2 |
# 3.5, 3.6 and presumably 2.7 are not available in it.
|
|
rdobuilder |
c7e8e2 |
- os: [ubuntu-20.04, macos-latest]
|
|
rdobuilder |
c7e8e2 |
+ os: [ubuntu-latest, macos-latest]
|
|
rdobuilder |
c7e8e2 |
+ exclude:
|
|
rdobuilder |
c7e8e2 |
+ - os: macos-latest
|
|
rdobuilder |
c7e8e2 |
+ python-version: 3.12.0~a1
|
|
rdobuilder |
c7e8e2 |
steps:
|
|
rdobuilder |
c7e8e2 |
- uses: actions/checkout@v3
|
|
rdobuilder |
c7e8e2 |
- name: Set up Python
|
|
rdobuilder |
c7e8e2 |
uses: actions/setup-python@v4
|
|
rdobuilder |
c7e8e2 |
+ if: "!contains(matrix.python-version, '~')"
|
|
rdobuilder |
c7e8e2 |
+ with:
|
|
rdobuilder |
c7e8e2 |
+ python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
+ - uses: deadsnakes/action@v2.1.1
|
|
rdobuilder |
c7e8e2 |
+ if: "contains(matrix.python-version, '~')"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
cache: 'pip'
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From dbe67e389158a5120bcaee857ce9df8d8e20240f Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Fri, 4 Nov 2022 12:56:25 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 03/12] Try a different way to specify version
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 8 ++++----
|
|
rdobuilder |
c7e8e2 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index 237a85b..7d3c3d4 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -25,23 +25,23 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
runs-on: ${{ matrix.os }}
|
|
rdobuilder |
c7e8e2 |
strategy:
|
|
rdobuilder |
c7e8e2 |
matrix:
|
|
rdobuilder |
c7e8e2 |
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12.0~a1"]
|
|
rdobuilder |
c7e8e2 |
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
|
|
rdobuilder |
c7e8e2 |
# Jan 2023: We have pinned back from ubuntu-latest (which is
|
|
rdobuilder |
c7e8e2 |
# now ubuntu 22.04) because older Python versions like
|
|
rdobuilder |
c7e8e2 |
# 3.5, 3.6 and presumably 2.7 are not available in it.
|
|
rdobuilder |
c7e8e2 |
os: [ubuntu-latest, macos-latest]
|
|
rdobuilder |
c7e8e2 |
exclude:
|
|
rdobuilder |
c7e8e2 |
- os: macos-latest
|
|
rdobuilder |
c7e8e2 |
- python-version: 3.12.0~a1
|
|
rdobuilder |
c7e8e2 |
+ python-version: 3.12
|
|
rdobuilder |
c7e8e2 |
steps:
|
|
rdobuilder |
c7e8e2 |
- uses: actions/checkout@v3
|
|
rdobuilder |
c7e8e2 |
- name: Set up Python
|
|
rdobuilder |
c7e8e2 |
uses: actions/setup-python@v4
|
|
rdobuilder |
c7e8e2 |
- if: "!contains(matrix.python-version, '~')"
|
|
rdobuilder |
c7e8e2 |
+ if: "!equals(matrix.python-version, '3.12')"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
- uses: deadsnakes/action@v2.1.1
|
|
rdobuilder |
c7e8e2 |
- if: "contains(matrix.python-version, '~')"
|
|
rdobuilder |
c7e8e2 |
+ if: "equals(matrix.python-version, '3.12')"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
cache: 'pip'
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 8d0cb88cfba16226e5a5936b3f48d838a15fbe28 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Fri, 4 Nov 2022 14:20:47 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 04/12] Fix syntax
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 4 ++--
|
|
rdobuilder |
c7e8e2 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index 7d3c3d4..90897af 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -37,11 +37,11 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
- uses: actions/checkout@v3
|
|
rdobuilder |
c7e8e2 |
- name: Set up Python
|
|
rdobuilder |
c7e8e2 |
uses: actions/setup-python@v4
|
|
rdobuilder |
c7e8e2 |
- if: "!equals(matrix.python-version, '3.12')"
|
|
rdobuilder |
c7e8e2 |
+ if: "matrix.python-version != '3.12'"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
- uses: deadsnakes/action@v2.1.1
|
|
rdobuilder |
c7e8e2 |
- if: "equals(matrix.python-version, '3.12')"
|
|
rdobuilder |
c7e8e2 |
+ if: "matrix.python-version == '3.12'"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
cache: 'pip'
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 51a334e65dafb171742f5a715ad89c3116900c04 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Wed, 16 Nov 2022 09:14:29 -0500
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 05/12] Use 3.12-dev instead of deadsnakes
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
Co-authored-by: Andreas Motl <andreas.motl@elmyra.de>
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 9 ++-------
|
|
rdobuilder |
c7e8e2 |
1 file changed, 2 insertions(+), 7 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index 90897af..060cc7f 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -25,23 +25,18 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
runs-on: ${{ matrix.os }}
|
|
rdobuilder |
c7e8e2 |
strategy:
|
|
rdobuilder |
c7e8e2 |
matrix:
|
|
rdobuilder |
c7e8e2 |
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
|
|
rdobuilder |
c7e8e2 |
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12-dev"]
|
|
rdobuilder |
c7e8e2 |
# Jan 2023: We have pinned back from ubuntu-latest (which is
|
|
rdobuilder |
c7e8e2 |
# now ubuntu 22.04) because older Python versions like
|
|
rdobuilder |
c7e8e2 |
# 3.5, 3.6 and presumably 2.7 are not available in it.
|
|
rdobuilder |
c7e8e2 |
os: [ubuntu-latest, macos-latest]
|
|
rdobuilder |
c7e8e2 |
exclude:
|
|
rdobuilder |
c7e8e2 |
- os: macos-latest
|
|
rdobuilder |
c7e8e2 |
- python-version: 3.12
|
|
rdobuilder |
c7e8e2 |
+ python-version: 3.12-dev
|
|
rdobuilder |
c7e8e2 |
steps:
|
|
rdobuilder |
c7e8e2 |
- uses: actions/checkout@v3
|
|
rdobuilder |
c7e8e2 |
- name: Set up Python
|
|
rdobuilder |
c7e8e2 |
uses: actions/setup-python@v4
|
|
rdobuilder |
c7e8e2 |
- if: "matrix.python-version != '3.12'"
|
|
rdobuilder |
c7e8e2 |
- with:
|
|
rdobuilder |
c7e8e2 |
- python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
- - uses: deadsnakes/action@v2.1.1
|
|
rdobuilder |
c7e8e2 |
- if: "matrix.python-version == '3.12'"
|
|
rdobuilder |
c7e8e2 |
with:
|
|
rdobuilder |
c7e8e2 |
python-version: ${{ matrix.python-version }}
|
|
rdobuilder |
c7e8e2 |
cache: 'pip'
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 387dee06179373e53b2d42447ea88f2acdcd2d1f Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Thu, 27 Apr 2023 09:52:14 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 06/12] Updates for PEP669
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet.cpp | 4 ++++
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_greenlet.hpp | 15 +++++++++------
|
|
rdobuilder |
c7e8e2 |
2 files changed, 13 insertions(+), 6 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet.cpp b/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
index 1d6ddaa..b382c5a 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
@@ -3092,7 +3092,11 @@ static PyObject*
|
|
rdobuilder |
c7e8e2 |
mod_get_tstate_trash_delete_nesting(PyObject* UNUSED(module))
|
|
rdobuilder |
c7e8e2 |
{
|
|
rdobuilder |
c7e8e2 |
PyThreadState* tstate = PyThreadState_GET();
|
|
rdobuilder |
c7e8e2 |
+#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ return PyLong_FromLong(tstate->trash.delete_nesting);
|
|
rdobuilder |
c7e8e2 |
+#else
|
|
rdobuilder |
c7e8e2 |
return PyLong_FromLong(tstate->trash_delete_nesting);
|
|
rdobuilder |
c7e8e2 |
+#endif
|
|
rdobuilder |
c7e8e2 |
}
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
static PyMethodDef GreenMethods[] = {
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
index 472902e..7146214 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -828,7 +828,9 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
the switch, use `will_switch_from`.
|
|
rdobuilder |
c7e8e2 |
*/
|
|
rdobuilder |
c7e8e2 |
this->cframe = tstate->cframe;
|
|
rdobuilder |
c7e8e2 |
+ #if !GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
this->use_tracing = tstate->cframe->use_tracing;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
@@ -843,13 +845,12 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
PyFrameObject *frame = PyThreadState_GetFrame((PyThreadState *)tstate);
|
|
rdobuilder |
c7e8e2 |
Py_XDECREF(frame); // PyThreadState_GetFrame gives us a new reference.
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.steal(frame);
|
|
rdobuilder |
c7e8e2 |
+ this->trash_delete_nesting = tstate->trash.delete_nesting;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.steal(tstate->frame);
|
|
rdobuilder |
c7e8e2 |
-#endif
|
|
rdobuilder |
c7e8e2 |
-
|
|
rdobuilder |
c7e8e2 |
- // All versions of Python.
|
|
rdobuilder |
c7e8e2 |
this->trash_delete_nesting = tstate->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+#endif
|
|
rdobuilder |
c7e8e2 |
}
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
@@ -868,7 +869,9 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
root_cframe here. See note above about why we can't
|
|
rdobuilder |
c7e8e2 |
just copy this from ``origin->cframe->use_tracing``.
|
|
rdobuilder |
c7e8e2 |
*/
|
|
rdobuilder |
c7e8e2 |
+ #if !GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
tstate->cframe->use_tracing = this->use_tracing;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
@@ -881,17 +884,17 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_top = this->datastack_top;
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_limit = this->datastack_limit;
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.relinquish_ownership();
|
|
rdobuilder |
c7e8e2 |
+ tstate->trash.delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
tstate->frame = this->_top_frame.relinquish_ownership();
|
|
rdobuilder |
c7e8e2 |
tstate->recursion_depth = this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ tstate->trash.delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
- // All versions of Python.
|
|
rdobuilder |
c7e8e2 |
- tstate->trash_delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
}
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
void PythonState::will_switch_from(PyThreadState *const origin_tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
{
|
|
rdobuilder |
c7e8e2 |
-#if GREENLET_USE_CFRAME
|
|
rdobuilder |
c7e8e2 |
+#if GREENLET_USE_CFRAME && !GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
// The weird thing is, we don't actually save this for an
|
|
rdobuilder |
c7e8e2 |
// effect on the current greenlet, it's saved for an
|
|
rdobuilder |
c7e8e2 |
// effect on the target greenlet. That is, we want
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From db74f88454dd36c3c6769bec680a16a1ac284b96 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Thu, 27 Apr 2023 09:54:50 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 07/12] Fix Python 3.11
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_greenlet.hpp | 8 ++++++++
|
|
rdobuilder |
c7e8e2 |
1 file changed, 8 insertions(+)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
index 7146214..41fda8e 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -845,7 +845,11 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
PyFrameObject *frame = PyThreadState_GetFrame((PyThreadState *)tstate);
|
|
rdobuilder |
c7e8e2 |
Py_XDECREF(frame); // PyThreadState_GetFrame gives us a new reference.
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.steal(frame);
|
|
rdobuilder |
c7e8e2 |
+ #if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
this->trash_delete_nesting = tstate->trash.delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+ #else
|
|
rdobuilder |
c7e8e2 |
+ this->trash_delete_nesting = tstate->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.steal(tstate->frame);
|
|
rdobuilder |
c7e8e2 |
@@ -884,7 +888,11 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_top = this->datastack_top;
|
|
rdobuilder |
c7e8e2 |
tstate->datastack_limit = this->datastack_limit;
|
|
rdobuilder |
c7e8e2 |
this->_top_frame.relinquish_ownership();
|
|
rdobuilder |
c7e8e2 |
+ #if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
tstate->trash.delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+ #else
|
|
rdobuilder |
c7e8e2 |
+ tstate->trash_delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+ #endif
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
tstate->frame = this->_top_frame.relinquish_ownership();
|
|
rdobuilder |
c7e8e2 |
tstate->recursion_depth = this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 132c4616f38e3c05899da1be22086d96e4981057 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Thu, 27 Apr 2023 09:56:56 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 08/12] Revert ubuntu-latest change
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 2 +-
|
|
rdobuilder |
c7e8e2 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index 060cc7f..fa48066 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -29,7 +29,7 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
# Jan 2023: We have pinned back from ubuntu-latest (which is
|
|
rdobuilder |
c7e8e2 |
# now ubuntu 22.04) because older Python versions like
|
|
rdobuilder |
c7e8e2 |
# 3.5, 3.6 and presumably 2.7 are not available in it.
|
|
rdobuilder |
c7e8e2 |
- os: [ubuntu-latest, macos-latest]
|
|
rdobuilder |
c7e8e2 |
+ os: [ubuntu-20.04, macos-latest]
|
|
rdobuilder |
c7e8e2 |
exclude:
|
|
rdobuilder |
c7e8e2 |
- os: macos-latest
|
|
rdobuilder |
c7e8e2 |
python-version: 3.12-dev
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From d26952ec3fb74c1f1d68104a4ac80018deb0618c Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Thu, 27 Apr 2023 09:58:22 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 09/12] Fix legacy versions
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_greenlet.hpp | 2 +-
|
|
rdobuilder |
c7e8e2 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
index 41fda8e..ffb23a7 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -896,7 +896,7 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
tstate->frame = this->_top_frame.relinquish_ownership();
|
|
rdobuilder |
c7e8e2 |
tstate->recursion_depth = this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
- tstate->trash.delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
+ tstate->trash_delete_nesting = this->trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
}
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 82f9a8869d88616decb777bc6afae3a751a4a9c0 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Thu, 27 Apr 2023 17:29:10 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 10/12] Print precise Python version
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
.github/workflows/tests.yml | 1 +
|
|
rdobuilder |
c7e8e2 |
1 file changed, 1 insertion(+)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
index fa48066..aa14318 100644
|
|
rdobuilder |
c7e8e2 |
--- a/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
+++ b/.github/workflows/tests.yml
|
|
rdobuilder |
c7e8e2 |
@@ -80,6 +80,7 @@ jobs:
|
|
rdobuilder |
c7e8e2 |
path: dist/*whl
|
|
rdobuilder |
c7e8e2 |
- name: Test
|
|
rdobuilder |
c7e8e2 |
run: |
|
|
rdobuilder |
c7e8e2 |
+ python -VV
|
|
rdobuilder |
c7e8e2 |
python -c 'import greenlet._greenlet as G; assert G.GREENLET_USE_STANDARD_THREADING'
|
|
rdobuilder |
c7e8e2 |
python -m unittest discover -v greenlet.tests
|
|
rdobuilder |
c7e8e2 |
- name: Doctest
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 3629e46c49533a994aa8f12ed3b41ae6725ab2ce Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Tue, 2 May 2023 10:48:37 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 11/12] Fix recursion depth updating
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet_greenlet.hpp | 19 ++++++++++++++++---
|
|
rdobuilder |
c7e8e2 |
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
index ffb23a7..10244e0 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet_greenlet.hpp
|
|
rdobuilder |
c7e8e2 |
@@ -143,7 +143,12 @@ namespace greenlet
|
|
rdobuilder |
c7e8e2 |
_PyCFrame* cframe;
|
|
rdobuilder |
c7e8e2 |
int use_tracing;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
+#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ int py_recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ int c_recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+#else
|
|
rdobuilder |
c7e8e2 |
int recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+#endif
|
|
rdobuilder |
c7e8e2 |
int trash_delete_nesting;
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
_PyInterpreterFrame* current_frame;
|
|
rdobuilder |
c7e8e2 |
@@ -748,7 +753,12 @@ PythonState::PythonState()
|
|
rdobuilder |
c7e8e2 |
,cframe(nullptr)
|
|
rdobuilder |
c7e8e2 |
,use_tracing(0)
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
+#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
+ ,py_recursion_depth(0)
|
|
rdobuilder |
c7e8e2 |
+ ,c_recursion_depth(0)
|
|
rdobuilder |
c7e8e2 |
+#else
|
|
rdobuilder |
c7e8e2 |
,recursion_depth(0)
|
|
rdobuilder |
c7e8e2 |
+#endif
|
|
rdobuilder |
c7e8e2 |
,trash_delete_nesting(0)
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
,current_frame(nullptr)
|
|
rdobuilder |
c7e8e2 |
@@ -834,7 +844,8 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
- this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ this->c_recursion_depth = C_RECURSION_LIMIT - tstate->c_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
@@ -879,7 +890,8 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
- tstate->py_recursion_remaining = tstate->py_recursion_limit - this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ tstate->py_recursion_remaining = tstate->py_recursion_limit - this->py_recursion_depth;
|
|
rdobuilder |
c7e8e2 |
+ tstate->c_recursion_remaining = C_RECURSION_LIMIT - this->c_recursion_depth;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
tstate->recursion_remaining = tstate->recursion_limit - this->recursion_depth;
|
|
rdobuilder |
c7e8e2 |
#endif
|
|
rdobuilder |
c7e8e2 |
@@ -915,7 +927,8 @@ void PythonState::set_initial_state(const PyThreadState* const tstate) G_NOEXCEP
|
|
rdobuilder |
c7e8e2 |
{
|
|
rdobuilder |
c7e8e2 |
this->_top_frame = nullptr;
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
- this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
+ this->c_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
#elif GREENLET_PY311
|
|
rdobuilder |
c7e8e2 |
this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
|
|
rdobuilder |
c7e8e2 |
#else
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
From 6bba85fdfd0acd1484780fae7a537e3dac99c067 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
c7e8e2 |
From: Michael Droettboom <mdboom@gmail.com>
|
|
rdobuilder |
c7e8e2 |
Date: Tue, 30 May 2023 12:14:22 -0400
|
|
rdobuilder |
c7e8e2 |
Subject: [PATCH 12/12] Insert blank line
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
---
|
|
rdobuilder |
c7e8e2 |
src/greenlet/greenlet.cpp | 1 +
|
|
rdobuilder |
c7e8e2 |
1 file changed, 1 insertion(+)
|
|
rdobuilder |
c7e8e2 |
|
|
rdobuilder |
c7e8e2 |
diff --git a/src/greenlet/greenlet.cpp b/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
index b382c5a..677fce8 100644
|
|
rdobuilder |
c7e8e2 |
--- a/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
+++ b/src/greenlet/greenlet.cpp
|
|
rdobuilder |
c7e8e2 |
@@ -3092,6 +3092,7 @@ static PyObject*
|
|
rdobuilder |
c7e8e2 |
mod_get_tstate_trash_delete_nesting(PyObject* UNUSED(module))
|
|
rdobuilder |
c7e8e2 |
{
|
|
rdobuilder |
c7e8e2 |
PyThreadState* tstate = PyThreadState_GET();
|
|
rdobuilder |
c7e8e2 |
+
|
|
rdobuilder |
c7e8e2 |
#if GREENLET_PY312
|
|
rdobuilder |
c7e8e2 |
return PyLong_FromLong(tstate->trash.delete_nesting);
|
|
rdobuilder |
c7e8e2 |
#else
|