From 1196ca397c7db058a245c25962bdd8ef98fedb40fc11b25ae77a71fe0ad9b67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Mon, 9 Sep 2024 10:56:04 +0000 Subject: [PATCH] - Cherry-pick upstream patch to add support for Python 3.13 * port-to-python313.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-greenlet?expand=0&rev=83 --- .gitattributes | 23 ++ .gitignore | 1 + greenlet-3.0.3.tar.gz | 3 + port-to-python313.patch | 454 ++++++++++++++++++++++++++++++++++++ python-greenlet-rpmlintrc | 1 + python-greenlet.changes | 473 ++++++++++++++++++++++++++++++++++++++ python-greenlet.spec | 102 ++++++++ 7 files changed, 1057 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 greenlet-3.0.3.tar.gz create mode 100644 port-to-python313.patch create mode 100644 python-greenlet-rpmlintrc create mode 100644 python-greenlet.changes create mode 100644 python-greenlet.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/greenlet-3.0.3.tar.gz b/greenlet-3.0.3.tar.gz new file mode 100644 index 0000000..47b388b --- /dev/null +++ b/greenlet-3.0.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43374442353259554ce33599da8b692d5aa96f8976d567d4badf263371fbe491 +size 182013 diff --git a/port-to-python313.patch b/port-to-python313.patch new file mode 100644 index 0000000..653061c --- /dev/null +++ b/port-to-python313.patch @@ -0,0 +1,454 @@ +From 94979488f841fcb41bd2bd3b80b5c0b011af4c94 Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Wed, 14 Feb 2024 16:37:42 +0100 +Subject: [PATCH 1/8] Fix #392: Port to Python 3.13 + +* Replace C_RECURSION_LIMIT with Py_C_RECURSION_LIMIT. +* Add Py_C_RECURSION_LIMIT for Python 3.12 and older. +* Disable GREENLET_USE_CFRAME on Python 3.13. +* Define Py_BUILD_CORE to include pycore_frame.h. +--- + src/greenlet/TPythonState.cpp | 10 +++++++--- + src/greenlet/greenlet_cpython_compat.hpp | 13 +++++++++++-- + src/greenlet/greenlet_greenlet.hpp | 1 + + 3 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/src/greenlet/TPythonState.cpp b/src/greenlet/TPythonState.cpp +index 465d4174..c0dbf703 100644 +--- a/src/greenlet/TPythonState.cpp ++++ b/src/greenlet/TPythonState.cpp +@@ -130,11 +130,13 @@ void PythonState::operator<<(const PyThreadState *const tstate) noexcept + #if GREENLET_PY311 + #if GREENLET_PY312 + this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining; +- this->c_recursion_depth = C_RECURSION_LIMIT - tstate->c_recursion_remaining; ++ this->c_recursion_depth = Py_C_RECURSION_LIMIT - tstate->c_recursion_remaining; + #else // not 312 + this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining; + #endif // GREENLET_PY312 ++ #if GREENLET_USE_CFRAME + this->current_frame = tstate->cframe->current_frame; ++ #endif + this->datastack_chunk = tstate->datastack_chunk; + this->datastack_top = tstate->datastack_top; + this->datastack_limit = tstate->datastack_limit; +@@ -199,12 +201,14 @@ void PythonState::operator>>(PyThreadState *const tstate) noexcept + #if GREENLET_PY311 + #if GREENLET_PY312 + tstate->py_recursion_remaining = tstate->py_recursion_limit - this->py_recursion_depth; +- tstate->c_recursion_remaining = C_RECURSION_LIMIT - this->c_recursion_depth; ++ tstate->c_recursion_remaining = Py_C_RECURSION_LIMIT - this->c_recursion_depth; + this->unexpose_frames(); + #else // \/ 3.11 + tstate->recursion_remaining = tstate->recursion_limit - this->recursion_depth; + #endif // GREENLET_PY312 ++ #if GREENLET_USE_CFRAME + tstate->cframe->current_frame = this->current_frame; ++ #endif + tstate->datastack_chunk = this->datastack_chunk; + tstate->datastack_top = this->datastack_top; + tstate->datastack_limit = this->datastack_limit; +@@ -238,7 +242,7 @@ void PythonState::set_initial_state(const PyThreadState* const tstate) noexcept + #if GREENLET_PY312 + this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining; + // XXX: TODO: Comment from a reviewer: +- // Should this be ``C_RECURSION_LIMIT - tstate->c_recursion_remaining``? ++ // Should this be ``Py_C_RECURSION_LIMIT - tstate->c_recursion_remaining``? + // But to me it looks more like that might not be the right + // initialization either? + this->c_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining; +diff --git a/src/greenlet/greenlet_cpython_compat.hpp b/src/greenlet/greenlet_cpython_compat.hpp +index cdc1617f..c0fb94c5 100644 +--- a/src/greenlet/greenlet_cpython_compat.hpp ++++ b/src/greenlet/greenlet_cpython_compat.hpp +@@ -12,19 +12,24 @@ + + #if PY_VERSION_HEX >= 0x30A00B1 + # define GREENLET_PY310 1 ++#else ++# define GREENLET_PY310 0 ++#endif ++ + /* + Python 3.10 beta 1 changed tstate->use_tracing to a nested cframe member. + See https://github.com/python/cpython/pull/25276 + We have to save and restore this as well. ++ ++Python 3.13 removed PyThreadState.cframe (GH-108035). + */ ++#if GREENLET_PY310 && PY_VERSION_HEX < 0x30D0000 + # define GREENLET_USE_CFRAME 1 + #else + # define GREENLET_USE_CFRAME 0 +-# define GREENLET_PY310 0 + #endif + + +- + #if PY_VERSION_HEX >= 0x30B00A4 + /* + Greenlet won't compile on anything older than Python 3.11 alpha 4 (see +@@ -124,4 +129,8 @@ static inline void PyThreadState_LeaveTracing(PyThreadState *tstate) + } + #endif + ++#if !defined(Py_C_RECURSION_LIMIT) && defined(C_RECURSION_LIMIT) ++# define Py_C_RECURSION_LIMIT C_RECURSION_LIMIT ++#endif ++ + #endif /* GREENLET_CPYTHON_COMPAT_H */ +diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp +index d52ce1fd..6da6841f 100644 +--- a/src/greenlet/greenlet_greenlet.hpp ++++ b/src/greenlet/greenlet_greenlet.hpp +@@ -23,6 +23,7 @@ using greenlet::refs::BorrowedGreenlet; + #endif + + #if GREENLET_PY312 ++# define Py_BUILD_CORE + # include "internal/pycore_frame.h" + #endif + + +From ee2f0c3e99a1cf65cd84b762f6cfcb997b873877 Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Wed, 14 Feb 2024 16:45:56 +0100 +Subject: [PATCH 2/8] Add Python 3.13 CI to GitHub Actions + +--- + .github/workflows/tests.yml | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml +index 66b2e458..29e84db0 100644 +--- a/.github/workflows/tests.yml ++++ b/.github/workflows/tests.yml +@@ -25,7 +25,7 @@ jobs: + runs-on: ${{ matrix.os }} + strategy: + matrix: +- python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] ++ python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v3 +@@ -35,6 +35,7 @@ jobs: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: setup.py ++ allow-prereleases: true + - name: Install dependencies + run: | + python -m pip install -U pip setuptools wheel + +From 00611d7567d09869973fe314f60575674cc877d8 Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Mon, 3 Jun 2024 10:55:14 +0200 +Subject: [PATCH 3/8] Support delete_later + +--- + src/greenlet/TPythonState.cpp | 14 ++++++++++++-- + src/greenlet/greenlet.cpp | 4 ++++ + src/greenlet/greenlet_cpython_compat.hpp | 6 ++++++ + src/greenlet/greenlet_greenlet.hpp | 4 ++++ + 4 files changed, 26 insertions(+), 2 deletions(-) + +diff --git a/src/greenlet/TPythonState.cpp b/src/greenlet/TPythonState.cpp +index c0dbf703..bfb40cac 100644 +--- a/src/greenlet/TPythonState.cpp ++++ b/src/greenlet/TPythonState.cpp +@@ -18,7 +18,11 @@ PythonState::PythonState() + #else + ,recursion_depth(0) + #endif ++#if GREENLET_PY313 ++ ,delete_later(nullptr) ++#else + ,trash_delete_nesting(0) ++#endif + #if GREENLET_PY311 + ,current_frame(nullptr) + ,datastack_chunk(nullptr) +@@ -145,7 +149,9 @@ void PythonState::operator<<(const PyThreadState *const tstate) noexcept + Py_XDECREF(frame); // PyThreadState_GetFrame gives us a new + // reference. + this->_top_frame.steal(frame); +- #if GREENLET_PY312 ++ #if GREENLET_PY313 ++ this->delete_later = Py_XNewRef(tstate->delete_later); ++ #elif GREENLET_PY312 + this->trash_delete_nesting = tstate->trash.delete_nesting; + #else // not 312 + this->trash_delete_nesting = tstate->trash_delete_nesting; +@@ -213,7 +219,11 @@ void PythonState::operator>>(PyThreadState *const tstate) noexcept + tstate->datastack_top = this->datastack_top; + tstate->datastack_limit = this->datastack_limit; + this->_top_frame.relinquish_ownership(); +- #if GREENLET_PY312 ++ #if GREENLET_PY313 ++ Py_XDECREF(tstate->delete_later); ++ tstate->delete_later = this->delete_later; ++ Py_CLEAR(this->delete_later); ++ #elif GREENLET_PY312 + tstate->trash.delete_nesting = this->trash_delete_nesting; + #else // not 3.12 + tstate->trash_delete_nesting = this->trash_delete_nesting; +diff --git a/src/greenlet/greenlet.cpp b/src/greenlet/greenlet.cpp +index 5a9818e8..dfc748a8 100644 +--- a/src/greenlet/greenlet.cpp ++++ b/src/greenlet/greenlet.cpp +@@ -1328,6 +1328,7 @@ mod_enable_optional_cleanup(PyObject* UNUSED(module), PyObject* flag) + Py_RETURN_NONE; + } + ++#if !GREENLET_PY313 + PyDoc_STRVAR(mod_get_tstate_trash_delete_nesting_doc, + "get_tstate_trash_delete_nesting() -> Integer\n" + "\n" +@@ -1343,6 +1344,7 @@ mod_get_tstate_trash_delete_nesting(PyObject* UNUSED(module)) + return PyLong_FromLong(tstate->trash_delete_nesting); + #endif + } ++#endif + + static PyMethodDef GreenMethods[] = { + {"getcurrent", +@@ -1356,7 +1358,9 @@ static PyMethodDef GreenMethods[] = { + {"get_total_main_greenlets", (PyCFunction)mod_get_total_main_greenlets, METH_NOARGS, mod_get_total_main_greenlets_doc}, + {"get_clocks_used_doing_optional_cleanup", (PyCFunction)mod_get_clocks_used_doing_optional_cleanup, METH_NOARGS, mod_get_clocks_used_doing_optional_cleanup_doc}, + {"enable_optional_cleanup", (PyCFunction)mod_enable_optional_cleanup, METH_O, mod_enable_optional_cleanup_doc}, ++#if !GREENLET_PY313 + {"get_tstate_trash_delete_nesting", (PyCFunction)mod_get_tstate_trash_delete_nesting, METH_NOARGS, mod_get_tstate_trash_delete_nesting_doc}, ++#endif + {NULL, NULL} /* Sentinel */ + }; + +diff --git a/src/greenlet/greenlet_cpython_compat.hpp b/src/greenlet/greenlet_cpython_compat.hpp +index c0fb94c5..ce5fd882 100644 +--- a/src/greenlet/greenlet_cpython_compat.hpp ++++ b/src/greenlet/greenlet_cpython_compat.hpp +@@ -55,6 +55,12 @@ Greenlet won't compile on anything older than Python 3.11 alpha 4 (see + # define GREENLET_PY312 0 + #endif + ++#if PY_VERSION_HEX >= 0x30D0000 ++# define GREENLET_PY313 1 ++#else ++# define GREENLET_PY313 0 ++#endif ++ + #ifndef Py_SET_REFCNT + /* Py_REFCNT and Py_SIZE macros are converted to functions + https://bugs.python.org/issue39573 */ +diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp +index 6da6841f..fbfdfbfc 100644 +--- a/src/greenlet/greenlet_greenlet.hpp ++++ b/src/greenlet/greenlet_greenlet.hpp +@@ -111,7 +111,11 @@ namespace greenlet + #else + int recursion_depth; + #endif ++#if GREENLET_PY313 ++ PyObject *delete_later; ++#else + int trash_delete_nesting; ++#endif + #if GREENLET_PY311 + _PyInterpreterFrame* current_frame; + _PyStackChunk* datastack_chunk; + +From b65558ec962d3d81ae09787ebca8686d233e2a4c Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Wed, 5 Jun 2024 12:04:21 +0200 +Subject: [PATCH 4/8] Fix current_frame + +--- + src/greenlet/TPythonState.cpp | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/greenlet/TPythonState.cpp b/src/greenlet/TPythonState.cpp +index bfb40cac..82eb34f0 100644 +--- a/src/greenlet/TPythonState.cpp ++++ b/src/greenlet/TPythonState.cpp +@@ -138,7 +138,9 @@ void PythonState::operator<<(const PyThreadState *const tstate) noexcept + #else // not 312 + this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining; + #endif // GREENLET_PY312 +- #if GREENLET_USE_CFRAME ++ #if GREENLET_PY313 ++ this->current_frame = tstate->current_frame; ++ #elif GREENLET_USE_CFRAME + this->current_frame = tstate->cframe->current_frame; + #endif + this->datastack_chunk = tstate->datastack_chunk; +@@ -212,7 +214,9 @@ void PythonState::operator>>(PyThreadState *const tstate) noexcept + #else // \/ 3.11 + tstate->recursion_remaining = tstate->recursion_limit - this->recursion_depth; + #endif // GREENLET_PY312 +- #if GREENLET_USE_CFRAME ++ #if GREENLET_PY313 ++ tstate->current_frame = this->current_frame; ++ #elif GREENLET_USE_CFRAME + tstate->cframe->current_frame = this->current_frame; + #endif + tstate->datastack_chunk = this->datastack_chunk; + +From b7cfc1748766cac351fe5fca32fa7c8cacdea2ae Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Wed, 5 Jun 2024 12:17:28 +0200 +Subject: [PATCH 5/8] Update tests + +--- + src/greenlet/tests/test_greenlet.py | 4 +++- + src/greenlet/tests/test_greenlet_trash.py | 9 +++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/greenlet/tests/test_greenlet.py b/src/greenlet/tests/test_greenlet.py +index 51849cd6..259707ae 100644 +--- a/src/greenlet/tests/test_greenlet.py ++++ b/src/greenlet/tests/test_greenlet.py +@@ -471,7 +471,9 @@ def creator(): + # Unfortunately, this doesn't actually clear the references, they're in the + # fast local array. + if not wait_for_cleanup: +- result[0].gr_frame.f_locals.clear() ++ # f_locals has no clear method in Python 3.13 ++ if hasattr(result[0].gr_frame.f_locals, 'clear'): ++ result[0].gr_frame.f_locals.clear() + else: + self.assertIsNone(result[0].gr_frame) + +diff --git a/src/greenlet/tests/test_greenlet_trash.py b/src/greenlet/tests/test_greenlet_trash.py +index 8d9716e9..2bce8fd0 100644 +--- a/src/greenlet/tests/test_greenlet_trash.py ++++ b/src/greenlet/tests/test_greenlet_trash.py +@@ -29,8 +29,17 @@ + + import unittest + ++try: ++ from greenlet._greenlet import get_tstate_trash_delete_nesting ++except ImportError: ++ get_tstate_trash_delete_nesting = None ++ ++ + class TestTrashCanReEnter(unittest.TestCase): + ++ # Python 3.13 has not "trash delete nesting" anymore (but "delete later") ++ @unittest.skipIf(get_tstate_trash_delete_nesting is None, ++ 'need get_tstate_trash_delete_nesting()') + def test_it(self): + # Try several times to trigger it, because it isn't 100% + # reliable. + +From 9b683398a91813fe861d9fc1e283b72bc17bfa61 Mon Sep 17 00:00:00 2001 +From: Jason Madden +Date: Wed, 4 Sep 2024 12:20:45 -0500 +Subject: [PATCH 6/8] Update test_greenlet_trash.py to avoid redefining + variables + +--- + src/greenlet/tests/test_greenlet_trash.py | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +diff --git a/src/greenlet/tests/test_greenlet_trash.py b/src/greenlet/tests/test_greenlet_trash.py +index 2bce8fd0..a3f58b7f 100644 +--- a/src/greenlet/tests/test_greenlet_trash.py ++++ b/src/greenlet/tests/test_greenlet_trash.py +@@ -29,18 +29,17 @@ + + import unittest + +-try: +- from greenlet._greenlet import get_tstate_trash_delete_nesting +-except ImportError: +- get_tstate_trash_delete_nesting = None +- + + class TestTrashCanReEnter(unittest.TestCase): + +- # Python 3.13 has not "trash delete nesting" anymore (but "delete later") +- @unittest.skipIf(get_tstate_trash_delete_nesting is None, +- 'need get_tstate_trash_delete_nesting()') + def test_it(self): ++ try: ++ from greenlet._greenlet import get_tstate_trash_delete_nesting ++ except ImportError: ++ import sys ++ # Python 3.13 has not "trash delete nesting" anymore (but "delete later") ++ assert sys.version_info[:2] >= (3, 13) ++ self.skipTest("get_tstate_trash_delete_nesting is not available.") + # Try several times to trigger it, because it isn't 100% + # reliable. + for _ in range(10): +@@ -48,7 +47,6 @@ def test_it(self): + + def check_it(self): # pylint:disable=too-many-statements + import greenlet +- from greenlet._greenlet import get_tstate_trash_delete_nesting # pylint:disable=no-name-in-module + + main = greenlet.getcurrent() + + +From 3d0f50129c4f889899e3ce341089a139241ef15b Mon Sep 17 00:00:00 2001 +From: Jason Madden +Date: Wed, 4 Sep 2024 12:27:01 -0500 +Subject: [PATCH 7/8] D'oh, removed one too many. + +--- + src/greenlet/tests/test_greenlet_trash.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/greenlet/tests/test_greenlet_trash.py b/src/greenlet/tests/test_greenlet_trash.py +index a3f58b7f..c734b983 100644 +--- a/src/greenlet/tests/test_greenlet_trash.py ++++ b/src/greenlet/tests/test_greenlet_trash.py +@@ -34,7 +34,8 @@ class TestTrashCanReEnter(unittest.TestCase): + + def test_it(self): + try: +- from greenlet._greenlet import get_tstate_trash_delete_nesting ++ # pylint:disable-next=no-name-in-module ++ from greenlet._greenlet import get_tstate_trash_delete_nesting + except ImportError: + import sys + # Python 3.13 has not "trash delete nesting" anymore (but "delete later") +@@ -47,7 +48,7 @@ def test_it(self): + + def check_it(self): # pylint:disable=too-many-statements + import greenlet +- ++ from greenlet._greenlet import get_tstate_trash_delete_nesting # pylint:disable=no-name-in-module + main = greenlet.getcurrent() + + assert get_tstate_trash_delete_nesting() == 0 + +From 3ce88eb9e5e153b3c8d2fb837441810e5a9cb144 Mon Sep 17 00:00:00 2001 +From: Jason Madden +Date: Wed, 4 Sep 2024 12:42:19 -0500 +Subject: [PATCH 8/8] Trailing whitespace makes the linter mad. Thanks GitHub + web editor. + +--- + src/greenlet/tests/test_greenlet_trash.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/greenlet/tests/test_greenlet_trash.py b/src/greenlet/tests/test_greenlet_trash.py +index c734b983..c1fc1374 100644 +--- a/src/greenlet/tests/test_greenlet_trash.py ++++ b/src/greenlet/tests/test_greenlet_trash.py +@@ -35,12 +35,13 @@ class TestTrashCanReEnter(unittest.TestCase): + def test_it(self): + try: + # pylint:disable-next=no-name-in-module +- from greenlet._greenlet import get_tstate_trash_delete_nesting ++ from greenlet._greenlet import get_tstate_trash_delete_nesting # pylint:disable=unused-import + except ImportError: + import sys + # Python 3.13 has not "trash delete nesting" anymore (but "delete later") + assert sys.version_info[:2] >= (3, 13) + self.skipTest("get_tstate_trash_delete_nesting is not available.") ++ + # Try several times to trigger it, because it isn't 100% + # reliable. + for _ in range(10): diff --git a/python-greenlet-rpmlintrc b/python-greenlet-rpmlintrc new file mode 100644 index 0000000..50f9bc7 --- /dev/null +++ b/python-greenlet-rpmlintrc @@ -0,0 +1 @@ +addFilter('devel-file-in-non-devel-package .*/greenlet/.*') diff --git a/python-greenlet.changes b/python-greenlet.changes new file mode 100644 index 0000000..aaaded4 --- /dev/null +++ b/python-greenlet.changes @@ -0,0 +1,473 @@ +------------------------------------------------------------------- +Mon Sep 9 09:29:56 UTC 2024 - John Paul Adrian Glaubitz + +- Cherry-pick upstream patch to add support for Python 3.13 + * port-to-python313.patch + +------------------------------------------------------------------- +Wed Jan 10 22:14:16 UTC 2024 - Ben Greiner + +- Update to 3.0.3 + * Python 3.12: Restore the full ability to walk the stack of a + suspended greenlet; previously only the innermost frame was + exposed. See issue 388. Fix by Joshua Oreman in PR 393. +- Disable building the docs: Now requires the furo theme, which is + not available. + +------------------------------------------------------------------- +Wed Jan 3 10:40:03 UTC 2024 - Dirk Müller + +- require setuptools + +------------------------------------------------------------------- +Sun Dec 17 01:45:41 UTC 2023 - Dirk Müller + +- update to 3.0.2: + * Packaging: Add a minimal ``pyproject.toml`` to sdists. + * Packaging: Various updates to macOS wheels. + * Fix a test case on Arm32. Note that this is not a supported + platform (there is no CI for it) and support is best effort; + +------------------------------------------------------------------- +Mon Nov 27 15:46:29 UTC 2023 - Dirk Müller + +- update to 3.0.1: + * Fix a potential crash on Python 3.8 at interpreter shutdown + time. This was a regression from earlier 3.0.x releases. + +------------------------------------------------------------------- +Wed Oct 4 06:25:18 UTC 2023 - Daniel Garcia + +- Update to 3.0.0: + * No changes from 3.0rc3 aside from the version number. +- Ignore some slow and flaky tests + +------------------------------------------------------------------- +Tue Sep 19 22:04:57 UTC 2023 - Dirk Müller + +- update to 3.0.0~rc3: + * Fix an intermittent error during process termination on some + platforms (GCC/Linux/libstdc++). + * Fix some potential bugs (assertion failures and memory leaks) in + previously-untested error handling code. In some cases, this means + that the process will execute a controlled ``abort()`` after severe + trouble when previously the process might have continued for some + time with a corrupt state. It is unlikely those errors occurred in + practice. + * Fix some assertion errors and potential bugs with re-entrant + switches. + * Fix a potential crash when certain compilers compile greenlet with + high levels of optimization. The symptom would be that switching to + a greenlet for the first time immediately crashes. + * Fix a potential crash when the callable object passed to the + greenlet constructor (or set as the ``greenlet.run`` attribute) has + a destructor attached to it that switches. Typically, triggering + this issue would require an unlikely subclass of + ``greenlet.greenlet``. + * Python 3.11+: Fix rare switching errors that could occur when a + garbage collection was triggered during the middle of a switch, and + Python-level code in ``__del__`` or weakref callbacks switched to a + different greenlet and ultimately switched back to the original + greenlet. This often manifested as a ``SystemError``: "switch + returned NULL without an exception set." + * Python 3.12: Fix walking the frame stack of suspended greenlets. + Previously accessing ``glet.gr_frame.f_back`` would crash due to + `changes in CPython's undocumented internal frame handling + * Make the platform-specific low-level C/assembly snippets stop using + the ``register`` storage class. Newer versions of standards remove + this storage class, and it has been generally ignored by many + compilers for some time. See `PR 347 + `_ from Khem + Raj. + * Add initial support for Python 3.12. See `issue + `_ and `PR + `_; thanks go + to (at least) Michael Droettboom, Andreas Motl, Thomas A Caswell, + raphaelauv, Hugo van Kemenade, Mark Shannon, and Petr Viktorin. + * Remove support for end-of-life Python versions, including Python + 2.7, Python 3.5 and Python 3.6. + * Require a compiler that supports ``noinline`` directives. See + `issue 271 + `_. + * Require a compiler that supports C++11. + +------------------------------------------------------------------- +Thu May 4 14:37:30 UTC 2023 - Dirk Müller + +- update to 2.0.2: + * Fix calling ``greenlet.settrace()`` with the same tracer + object that was currently active. + * Various compilation and standards conformance fixes. + * Python 3.11: Fix a memory leak. See issue 328 and gevent issue 1924. +- 2.0.0.post0 (2022-11-03) + * Add Programming Language :: Python :: 3.11 to the PyPI classifier + metadata. +- 2.0.0rc5 (2022-10-31) + * Linux: Fix another group of rare crashes that could occur when shutting + down an interpeter running multiple threads. See issue 325. +- 2.0.0rc4 (2022-10-30) + * Linux: Fix a rare crash that could occur when shutting down an interpreter + running multiple threads, when some of those threads are in greenlets + making calls to functions that release the GIL. +- 2.0.0rc1 (2022-10-27) + * Deal gracefully with greenlet switches that occur while deferred + deallocation of objects is happening using CPython's "trash can" + mechanism. Previously, if a large nested container held items that + switched greenlets during delayed deallocation, and that second greenlet + also invoked the trash can, CPython's internal state could become corrupt. + This was visible as an assertion error in debug builds. Now, the relevant + internal state is saved and restored during greenlet switches. See also + gevent issue 1909. + * Rename the C API function PyGreenlet_GET_PARENT to PyGreenlet_GetParent + for consistency. The old name remains available as a deprecated alias. +- 2.0.0a1 (2022-01-20) + * Drop support for very old versions of GCC and MSVC. + Compilation now requires a compiler that either supports C++11 or has some + other intrinsic way to create thread local variables; for older GCC, clang + and SunStudio we use __thread, while for older MSVC we use + __declspec(thread). + * This version of greenlet is known to compile and pass tests on CPython + 3.11.0a4. Earlier or later 3.11 releases may or may not work. See PR 280. + Special thanks to Brandt Bucher and the CPython developers. + * Fix several leaks that could occur when using greenlets from multiple + threads. For example, it is no longer necessary to call getcurrent() + before exiting a thread to allow its main greenlet to be cleaned up. See + issue 252. + * Fix the C API PyGreenlet_Throw to perform the same error checking that the + Python API greenlet.throw() does. Previously, it did no error checking. +- drop sphinx-6.0.0.patch (upstream) + +------------------------------------------------------------------- +Fri Apr 21 12:25:51 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:41:39 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Thu Jan 5 07:41:02 UTC 2023 - Daniel Garcia + +- Add sphinx-6.0.0.patch to make it work with new version of Sphinx. + +------------------------------------------------------------------- +Mon Sep 12 20:13:22 UTC 2022 - Dirk Müller + +- update to 1.1.3: + * Add support for Python 3.11. + +------------------------------------------------------------------- +Sat Oct 16 19:07:41 UTC 2021 - Dirk Müller + +- update to 1.1.2: + - Fix a potential crash due to a reference counting error when Python + subclasses of ``greenlet.greenlet`` were deallocated. The crash + became more common on Python 3.10; on earlier versions, silent + memory corruption could result. + - Fix a leak of a list object when the last reference to a greenlet + was deleted from some other thread than the one to which it + belonged. For this to work correctly, you must call a greenlet API + like ``getcurrent()`` before the thread owning the greenlet exits: + this is a long-standing limitation that can also lead to the leak of + a thread's main greenlet if not called; we hope to lift this + limitation. Note that in some cases this may also fix leaks of + greenlet objects themselves. See `issue 251 + - Python 3.10: Tracing or profiling into a spawned greenlet didn't + work as expected. See `issue 256 + +------------------------------------------------------------------- +Mon Aug 30 11:46:34 UTC 2021 - pgajdos@suse.com + +- %check: use %pyunittest rpm macro + +------------------------------------------------------------------- +Sun Jun 6 12:37:38 UTC 2021 - Dirk Müller + +- update to 1.1.0: + * Add support for Python 3.10. Pre-built binary wheels for 3.10 are + not currently available for all platforms. The greenlet ABI is + different on Python 3.10 from all previous versions, but as 3.10 was + never supported before, and the ABI has not changed on other Python + versions, this is not considered a reason to change greenlet's major + version. + +------------------------------------------------------------------- +Mon Feb 1 22:13:52 UTC 2021 - Dirk Müller + +- update to 1.0.0: + * Require setuptools to build from source. + * Stop asking setuptools to build both .tar.gz and .zip + sdists. PyPI has standardized on .tar.gz for all platforms. + * Publish the change log to https://greenlet.readthedocs.io + +------------------------------------------------------------------- +Mon Sep 28 10:54:19 UTC 2020 - Dirk Mueller + +- update to 0.4.17: + - Support for PEP 567 ContextVars + +------------------------------------------------------------------- +Mon Jun 8 19:32:54 UTC 2020 - Dirk Mueller + +- update to 0.4.16: + - Support for DEC Alpha architecture + - Support for Python 3.9 + - Support for Python 3.10a0 + +------------------------------------------------------------------- +Sun Sep 16 15:31:38 UTC 2018 - Arun Persaud + +- specfile: + * update copyright year + * be more specific in %files section + +- update to version 0.4.15: + * Support for RISC-V architecture + * Workaround a gcc bug on ppc64 + +------------------------------------------------------------------- +Tue Aug 7 15:26:22 UTC 2018 - toddrme2178@gmail.com + +- Update to 0.4.14 + * Support for C-SKY architecture + * Fixed support for ppc64 ABI + * Fixed support for Python 3.7 +- Remove upstream-included greenlet-ppc64le.patch + +------------------------------------------------------------------- +Fri Feb 2 13:34:46 UTC 2018 - tchvatal@suse.com + +- Add patch to fix build on ppc64le to not clobber r2 register: + * greenlet-ppc64le.patch + +------------------------------------------------------------------- +Fri Feb 2 13:32:25 UTC 2018 - tchvatal@suse.com + +- Version update to 0.4.13: + * Support for Python 3.7 + * Support for MinGW x64 + +------------------------------------------------------------------- +Wed Apr 19 17:46:25 UTC 2017 - toddrme2178@gmail.com + +- Update to 0.4.12 + * Stop using trashcan api +- Update to 0.4.11 + * Fixes for aarch64 architecture +- Implement singlespec version + +------------------------------------------------------------------- +Fri Sep 2 21:10:46 UTC 2016 - tbechtold@suse.com + +- update to 4.10.0: + - Added missing files to manifest + - Added workaround for ppc32 on Linux + - Start building binary manylinux1 wheels +- Use pypi.io as Source url + +------------------------------------------------------------------- +Sat Apr 16 21:29:08 UTC 2016 - t.gruner@katodev.de + +- update to 0.4.9 +- remove ppc64le-support.patch (is part of this version now) + +------------------------------------------------------------------- +Mon Jun 22 14:34:33 UTC 2015 - tbechtold@suse.com + +- update to 0.4.7: + - Added a missing workaround for `return 0` on mips + - Restore compatibility with Python 2.5 + - Fixed stack switching on sparc + +------------------------------------------------------------------- +Wed May 6 12:29:51 UTC 2015 - benoit.monin@gmx.fr + +- update to version 0.4.6: + * Expose `_stack_saved` property on greenlet objects, it may be + used to introspect the amount of memory used by a saved stack, + but the API is subject to change in the future + * Added a workaround for `return 0` compiler optimizations on all + architectures + * C API typo fixes +- add -fno-strict-aliasing to CFLAGS to fix compiler warnings +- remove hidden file .buildinfo from html documentation + +------------------------------------------------------------------- +Tue Nov 18 13:57:34 UTC 2014 - toddrme2178@gmail.com + +- Update to 0.4.5 + - Fixed several bugs in greenlet C API + - Fixed a bug in multi-threaded applications, which manifested itself + with spurious "cannot switch to a different thread" exceptions + - Fixed some crashes on arm and mips architectures + +------------------------------------------------------------------- +Thu Nov 6 04:56:09 UTC 2014 - tserong@suse.com + +- Include LICENSE and LICENSE.PSF in package + +------------------------------------------------------------------- +Mon Nov 3 22:19:05 UTC 2014 - dvaleev@suse.com + +- build with -fno-tree-dominator-opts (boo#902146) + +------------------------------------------------------------------- +Fri Sep 12 21:22:30 UTC 2014 - dmueller@suse.com + +- update to 0.4.4: + - Fixed PyGreenlet_SetParent signature, thanks to BoonsNaibot + - Fixed 64-bit Windows builds depending on wrong runtime dll + +------------------------------------------------------------------- +Fri Aug 15 11:58:41 UTC 2014 - mcihar@suse.cz + +- Update to version 0.4.3: + + Better slp_switch performance on SPARC + + Drop support for Python 2.3 + + Fix trashcan assertions on debug builds of Python + + Remove deprecated -fno-tree-dominator-opts compiler switch + + Enable switch code for SunStudio on 32-bit SunOS + + Support for abc abstract methods in greenlet subclasses + + Support custom directories for tests + + Document switch tracing support + +------------------------------------------------------------------- +Fri Jan 17 15:26:02 UTC 2014 - speilicke@suse.com + +- Update to version 0.4.2: + + Add .travis.yml + + Fix 'err' may be used uninitialized in this function + + Check _MSC_VER for msvc specific code + + Fix slp_switch on SPARC for multi-threaded environments + + Add support for m68k + +------------------------------------------------------------------- +Tue Dec 10 12:33:07 UTC 2013 - uweigand@de.ibm.com + +- ppc64le-support.patch: Support powerpc64le-linux (ELFv2 ABI). + Save/restore vector and floating-point registers as well on ppc. + +------------------------------------------------------------------- +Thu Oct 24 11:06:14 UTC 2013 - speilicke@suse.com + +- Require python-setuptools instead of distribute (upstreams merged) + +------------------------------------------------------------------- +Thu Aug 8 10:54:47 UTC 2013 - dvaleev@suse.com + +- run tests we optflags. Stuff got compiled in %check again. + +------------------------------------------------------------------- +Tue Aug 6 12:34:48 UTC 2013 - speilicke@suse.com + +- Drop python-greenlet-aarch64-support.diff + +------------------------------------------------------------------- +Mon Jun 10 12:35:26 UTC 2013 - dmueller@suse.com + +- update to 0.4.1: + * fix segfaults when using gcc 4.8 on amd64/x86 unix + * try to disable certain gcc 4.8 optimizations that make greenlet + crash + * Fix greenlet on aarch64 with gcc 4.8 + * workaround segfault on SunOS/sun4v + * Add support for Aarch64 + * Add support for x32 psABI on x86_64 + * Changed memory constraints for assembly macro for PPC Linux + platforms. +- remove python-greenlet-aarch64-support.diff + +------------------------------------------------------------------- +Mon Apr 8 11:40:21 UTC 2013 - matz@suse.de + +- Add python-greenlet-aarch64-support.diff, for, well, aarch64 + support. + +------------------------------------------------------------------- +Wed Jan 2 18:01:09 UTC 2013 - toddrme2178@gmail.com + +- Fix building on SLES + +------------------------------------------------------------------- +Wed Dec 19 15:52:27 UTC 2012 - saschpe@suse.de + +- The devel subpackage contains only headers and thus is noarch + +------------------------------------------------------------------- +Fri Nov 23 12:05:16 UTC 2012 - saschpe@suse.de + +- Update to version 0.4.0: + + Greenlet has an instance dictionary now, which means it can be + used for implementing greenlet local storage, etc. However, this + might introduce incompatibility if subclasses have __dict__ in their + __slots__. Classes like that will fail, because greenlet already + has __dict__ out of the box. + + Greenlet no longer leaks memory after thread termination, as long as + terminated thread has no running greenlets left at the time. + + Add support for debian sparc and openbsd5-sparc64 + + Add support for ppc64 linux + + Don't allow greenlets to be copied with copy.copy/deepcopy + + Fix arm32/thumb support + + Restore greenlet's parent after kill + + Add experimental greenlet tracing +- Changes from version 0.3.4: + + Use plain distutils for install command, this fixes installation of + the greenlet.h header. + + Enhanced arm32 support + + Fix support for Linux/S390 zSeries + + Workaround compiler bug on RHEL 3 / CentOS 3 +- Changes from version 0.3.3: + + Use sphinx to build documentation and publish it on greenlet.rtfd.org + + Prevent segfaults on openbsd 4/i386 + + Workaround gcc-4.0 not allowing to clobber rbx + + Enhance test infrastructure + + Fix possible compilation problems when including greenlet.h in C++ mode + + Make the greenlet module work on x64 windows + + Add a test for greenlet C++ exceptions + + Fix compilation on Solaris with SunStudio +- Changes from version 0.3.2: + + Fix various crashes with recent gcc versions and VC90 + + Try to fix stack save/restore on arm32 + + Store and restore the threadstate on exceptions like pypy/stackless do + + GreenletExit is now based on BaseException on Python >= 2.5 + + Switch to using PyCapsule for Python 2.7 and 3.1 + + Port for AIX on PowerPC + + Fix the sparc/solaris header + + Improved build dependencies patch from flub. + + Can't pass parent=None to greenlet.greenlet() (fixes #21) + + Rudimentary gc support (only non-live greenlets are garbage collected though) +- Dropped the following patches (merged upstream): + + get-rid-of-ts_origin.patch + + i686-register-fixes.patch + + ppc-support.patch + + ppc64-support.patch +- Build HTML documentation + +------------------------------------------------------------------- +Tue Jul 3 09:53:32 UTC 2012 - dvaleev@suse.com + +- add ppc64 platform support +- fix ppc platform + +------------------------------------------------------------------- +Fri Dec 23 13:20:47 UTC 2011 - idonmez@suse.com + +- Add upstream commits 25bf29f4d3b7 and 2d5b17472757 (bnc#738431) +- Implement %check + +------------------------------------------------------------------- +Wed Sep 21 09:35:58 UTC 2011 - saschpe@suse.de + +- Spec file cleanup: + * BuildRequire modern python-distribute instead of python-setuptools + * No need for changing executable bits for benchmarks + * Use SUSE version checks around specific macros + * Only require %{name} = %{version} in devel package + +------------------------------------------------------------------- +Fri Nov 26 14:44:42 UTC 2010 - seife+obs@b1-systems.com + +- initial package (version 0.3.1) + diff --git a/python-greenlet.spec b/python-greenlet.spec new file mode 100644 index 0000000..0846e1e --- /dev/null +++ b/python-greenlet.spec @@ -0,0 +1,102 @@ +# +# spec file for package python-greenlet +# +# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2010 B1 Systems GmbH, Vohburg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +# Requires python-furo +%bcond_with docs + +%{?sle15_python_module_pythons} +Name: python-greenlet +Version: 3.0.3 +Release: 0 +Summary: Lightweight in-process concurrent programming +License: MIT +Group: Development/Libraries/Python +URL: https://github.com/python-greenlet/greenlet +Source0: https://files.pythonhosted.org/packages/source/g/greenlet/greenlet-%{version}.tar.gz +Source9: python-greenlet-rpmlintrc +# PATCH-FIX-UPSTREAM gh/python-greenlet/greenlet#396 - Port to Python 3.13 +Patch0: https://github.com/python-greenlet/greenlet/pull/396.patch#/port-to-python313.patch +BuildRequires: %{python_module devel >= 3.7} +BuildRequires: %{python_module objgraph} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module psutil} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: c++_compiler +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with docs} +BuildRequires: python3-Sphinx +BuildRequires: python3-furo +%endif +%python_subpackages + +%description +The greenlet package is a spin-off of Stackless, a version of CPython +that supports micro-threads called "tasklets". Tasklets run +pseudo-concurrently (typically in a single or a few OS-level threads) +and are synchronized with data exchanges on "channels". + +%package devel +Summary: C development headers for python-greenlet +Group: Development/Libraries/Python +Requires: %{name} = %{version} +BuildArch: noarch + +%description devel +This package contains header files required for C modules development. + +%prep +%autosetup -p1 -n greenlet-%{version} +sed -i '1{/env python/d}' src/greenlet/tests/test_version.py + +%build +export CFLAGS="%{optflags} -fno-tree-dominator-opts -fno-strict-aliasing" +%pyproject_wheel + +%if %{with docs} +export PYTHONPATH=$PWD/src +cd docs && make html && rm _build/html/.buildinfo +%endif + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} + +%check +export CFLAGS="%{optflags} -fno-tree-dominator-opts -fno-strict-aliasing" +# ignore some Flaky tests +export GREENLET_MANYLINUX=1 +%pyunittest_arch discover -v greenlet.tests + +%files %{python_files} +%doc AUTHORS CHANGES.rst README.rst +%if %{with docs} +%doc docs/_build/html/ +%endif +%license LICENSE* +%{python_sitearch}/greenlet +%{python_sitearch}/greenlet-%{version}.dist-info + +%files %{python_files devel} +%doc AUTHORS +%license LICENSE* +%{_includedir}/python%{python_version}*/greenlet/ + +%changelog