Compare commits
No commits in common. "main-riscv64" and "master" have entirely different histories.
main-riscv
...
master
13
.gitignore
vendored
13
.gitignore
vendored
@ -9,16 +9,3 @@ greenlet-0.3.1.tar.gz
|
||||
/greenlet-0.4.12.tar.gz
|
||||
/greenlet-0.4.13.tar.gz
|
||||
/greenlet-0.4.14.tar.gz
|
||||
/greenlet-0.4.16.tar.gz
|
||||
/greenlet-0.4.17.tar.gz
|
||||
/greenlet-1.1.0.tar.gz
|
||||
/greenlet-1.1.1.tar.gz
|
||||
/greenlet-1.1.2.tar.gz
|
||||
/greenlet-1.1.3.tar.gz
|
||||
/greenlet-2.0.2.tar.gz
|
||||
/greenlet-3.0.0a1.tar.gz
|
||||
/greenlet-3.0.0rc1.tar.gz
|
||||
/greenlet-3.0.0.tar.gz
|
||||
/greenlet-3.0.1.tar.gz
|
||||
/greenlet-3.0.2.tar.gz
|
||||
/greenlet-3.0.3.tar.gz
|
||||
|
342
396.patch
342
396.patch
@ -1,342 +0,0 @@
|
||||
From 94979488f841fcb41bd2bd3b80b5c0b011af4c94 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <vstinner@python.org>
|
||||
Date: Wed, 14 Feb 2024 16:37:42 +0100
|
||||
Subject: [PATCH 1/5] 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 465d417..c0dbf70 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 cdc1617..c0fb94c 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 d52ce1f..6da6841 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 <vstinner@python.org>
|
||||
Date: Wed, 14 Feb 2024 16:45:56 +0100
|
||||
Subject: [PATCH 2/5] 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 66b2e45..29e84db 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 <vstinner@python.org>
|
||||
Date: Mon, 3 Jun 2024 10:55:14 +0200
|
||||
Subject: [PATCH 3/5] 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 c0dbf70..bfb40ca 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 5a9818e..dfc748a 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 c0fb94c..ce5fd88 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 6da6841..fbfdfbf 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 <vstinner@python.org>
|
||||
Date: Wed, 5 Jun 2024 12:04:21 +0200
|
||||
Subject: [PATCH 4/5] 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 bfb40ca..82eb34f 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 <vstinner@python.org>
|
||||
Date: Wed, 5 Jun 2024 12:17:28 +0200
|
||||
Subject: [PATCH 5/5] 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 51849cd..259707a 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 8d9716e..2bce8fd 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.
|
48
c644ca6823994b958e004b3e00b587723181b58e.patch
Normal file
48
c644ca6823994b958e004b3e00b587723181b58e.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From d05b62bb75e6a3e217435a1fe0f15a53e692898c Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <vstinner@python.org>
|
||||
Date: Wed, 18 Mar 2020 15:09:33 +0100
|
||||
Subject: [PATCH] Port to Python 3.9
|
||||
|
||||
On Python 3.9, define _Py_DEC_REFTOTAL which has been removed by:
|
||||
https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924
|
||||
|
||||
Replace also PyEval_CallObjectWithKeywords() with PyObject_Call(),
|
||||
since PyEval_CallObjectWithKeywords() has been deprecated in
|
||||
Python 3.9 and PyObject_Call() has the same behavior. The only
|
||||
difference is that PyEval_CallObjectWithKeywords() can be called with
|
||||
args=NULL, but g_initialstub() ensures that args is not NULL.
|
||||
---
|
||||
greenlet.c | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/greenlet.c b/greenlet.c
|
||||
index ec738b9..d37fc97 100644
|
||||
--- a/greenlet.c
|
||||
+++ b/greenlet.c
|
||||
@@ -109,6 +109,16 @@ extern PyTypeObject PyGreenlet_Type;
|
||||
#define GREENLET_USE_TRACING 1
|
||||
#endif
|
||||
|
||||
+#ifndef _Py_DEC_REFTOTAL
|
||||
+ /* _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
|
||||
+ https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924 */
|
||||
+# ifdef Py_REF_DEBUG
|
||||
+# define _Py_DEC_REFTOTAL _Py_RefTotal--
|
||||
+# else
|
||||
+# define _Py_DEC_REFTOTAL
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
/* Weak reference to the switching-to greenlet during the slp switch */
|
||||
static PyGreenlet* volatile ts_target = NULL;
|
||||
/* Strong reference to the switching from greenlet after the switch */
|
||||
@@ -820,8 +830,7 @@ static int GREENLET_NOINLINE(g_initialstub)(void* mark)
|
||||
result = NULL;
|
||||
} else {
|
||||
/* call g.run(*args, **kwargs) */
|
||||
- result = PyEval_CallObjectWithKeywords(
|
||||
- run, args, kwargs);
|
||||
+ result = PyObject_Call(run, args, kwargs);
|
||||
Py_DECREF(args);
|
||||
Py_XDECREF(kwargs);
|
||||
}
|
@ -1,34 +1,14 @@
|
||||
%global modname greenlet
|
||||
|
||||
%ifarch riscv64
|
||||
# to avoid compile time errors
|
||||
%undefine _include_frame_pointers
|
||||
%endif
|
||||
|
||||
Name: python-%{modname}
|
||||
Version: 3.0.3
|
||||
Release: 5.1.riscv64%{?dist}
|
||||
Version: 0.4.14
|
||||
Release: 8%{?dist}
|
||||
Summary: Lightweight in-process concurrent programming
|
||||
License: MIT AND PSF-2.0
|
||||
License: MIT
|
||||
URL: https://github.com/python-greenlet/greenlet
|
||||
Source0: %{url}/archive/%{version}/%{modname}-%{version}.tar.gz
|
||||
|
||||
# Skip leak checking to avoid a missing dependency, `objgraph`
|
||||
Patch: skip-leak-checks.patch
|
||||
# Fix #392: Port to Python 3.13
|
||||
# https://github.com/python-greenlet/greenlet/pull/396
|
||||
#
|
||||
# Fixes:
|
||||
#
|
||||
# Fail to build with Python 3.13
|
||||
# https://github.com/python-greenlet/greenlet/issues/392
|
||||
#
|
||||
# python-greenlet fails to build with Python 3.13: error: #error "this header
|
||||
# requires Py_BUILD_CORE define"
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2245874
|
||||
Patch: %{url}/pull/396.patch
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
Patch1: %{url}/commit/c644ca6823994b958e004b3e00b587723181b58e.patch
|
||||
|
||||
%global _description \
|
||||
The greenlet package is a spin-off of Stackless, a version of CPython\
|
||||
@ -40,9 +20,9 @@ and are synchronized with data exchanges on "channels".
|
||||
|
||||
%package -n python3-%{modname}
|
||||
Summary: %{summary}
|
||||
%{?python_provide:%python_provide python3-%{modname}}
|
||||
BuildRequires: python3-devel
|
||||
# For tests
|
||||
BuildRequires: python3-psutil
|
||||
BuildRequires: python3-setuptools
|
||||
|
||||
%description -n python3-%{modname} %{_description}
|
||||
|
||||
@ -50,6 +30,7 @@ Python 3 version.
|
||||
|
||||
%package -n python3-%{modname}-devel
|
||||
Summary: C development headers for python3-%{modname}
|
||||
%{?python_provide:%python_provide python3-%{modname}-devel}
|
||||
Requires: python3-%{modname}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
|
||||
%description -n python3-%{modname}-devel
|
||||
@ -60,129 +41,25 @@ Python 3 version.
|
||||
%prep
|
||||
%autosetup -n %{modname}-%{version} -p1
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%pyproject_save_files %{modname}
|
||||
|
||||
%py3_install
|
||||
|
||||
%check
|
||||
cd /
|
||||
PYTHONPATH="%{buildroot}%{python3_sitearch}" \
|
||||
%{python3} -m unittest discover -v \
|
||||
-s "%{buildroot}%{python3_sitearch}/greenlet/tests" \
|
||||
-t "%{buildroot}%{python3_sitearch}"
|
||||
%{__python3} setup.py test
|
||||
|
||||
%files -n python3-%{modname} -f %{pyproject_files}
|
||||
%doc AUTHORS README.rst
|
||||
%files -n python3-%{modname}
|
||||
%license LICENSE LICENSE.PSF
|
||||
%doc AUTHORS NEWS README.rst
|
||||
%{python3_sitearch}/%{modname}-*.egg-info
|
||||
%{python3_sitearch}/%{modname}*.so
|
||||
|
||||
%files -n python3-greenlet-devel
|
||||
%{_includedir}/python%{python3_version}*/%{modname}/
|
||||
|
||||
%changelog
|
||||
* Thu Jul 11 2024 David Abdurachmanov <davidlt@rivosinc.com> - 3.0.3-5.1.riscv64
|
||||
- Do not allow tests to fail
|
||||
|
||||
* Thu Jul 11 2024 David Abdurachmanov <davidlt@rivosinc.com> - 3.0.3-5.0.riscv64
|
||||
- Allow tests to fail
|
||||
- Undefine _include_frame_pointers for riscv64
|
||||
|
||||
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 3.0.3-5
|
||||
- Rebuilt for Python 3.13
|
||||
|
||||
* Thu May 30 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.3-4
|
||||
- Patch for Python 3.13 (close RHBZ#2245874)
|
||||
|
||||
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sat Jan 13 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.0.3-1
|
||||
- 3.0.3
|
||||
|
||||
* Mon Dec 11 2023 Terje Rosten <terje.rosten@ntnu.no> - 3.0.2-1
|
||||
- 3.0.2
|
||||
|
||||
* Sat Nov 25 2023 Terje Rosten <terje.rosten@ntnu.no> - 3.0.1-1
|
||||
- 3.0.1
|
||||
|
||||
* Sat Oct 14 2023 Terje Rosten <terje.rosten@ntnu.no> - 3.0.0-1
|
||||
- 3.0.0
|
||||
|
||||
* Wed Sep 06 2023 Carl George <carlwgeorge@fedoraproject.org> - 3.0.0~rc1-1
|
||||
- Update to version 3.0.0rc1
|
||||
- Convert to pyproject macros
|
||||
|
||||
* Sun Aug 13 2023 Orion Poplawski <orion@nwra.com> - 3.0.0~a1-1
|
||||
- Update to 3.0.0a1
|
||||
|
||||
* Sat Aug 05 2023 Ondřej Budai <ondrej@budai.cz> - 2.0.2-3
|
||||
- SPDX migration
|
||||
|
||||
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Jun 14 2023 Petr Viktorin <pviktori@redhat.com> - 2.0.2-1
|
||||
- Update to upstream version 2.0.2
|
||||
- Update patch for Python 3.12 compatibility
|
||||
- Skip leak checks for now
|
||||
|
||||
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.1.3-3
|
||||
- Rebuilt for Python 3.12
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Oct 14 2022 Lumír Balhar <lbalhar@redhat.com> - 1.1.3-1
|
||||
- Update to 1.1.3
|
||||
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.1.2-4
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
* Wed Jun 01 2022 Miro Hrončok <mhroncok@redhat.com> - 1.1.2-3
|
||||
- Python 3.11 support
|
||||
- Fixes: rhbz#2040186
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Sep 30 2021 Kevin Fenzi <kevin@scrye.com> - 1.1.2-1
|
||||
- Update to 1.1.2. Fixes rhbz#2008848
|
||||
|
||||
* Sat Aug 07 2021 Kevin Fenzi <kevin@scrye.com> - 1.1.1-1
|
||||
- Update to 1.1.1.
|
||||
- Fixes rhbz#1990901
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 1.1.0-2
|
||||
- Rebuilt for Python 3.10
|
||||
|
||||
* Mon May 10 2021 Nils Philippsen <nils@tiptoe.de> - 1.1.0-1
|
||||
- Update to 1.1.0
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.17-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Sat Oct 31 2020 Kevin Fenzi <kevin@scrye.com> - 0.4.17-1
|
||||
- Update to 0.4.17. Fixes bug #1881455
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.16-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Sat Jun 06 2020 Orion Poplawski <orion@nwra.com> - 0.4.16-1
|
||||
- Update to 0.4.16
|
||||
|
||||
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 0.4.14-8
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
|
@ -1,293 +0,0 @@
|
||||
diff --git a/src/greenlet/tests/leakcheck.py b/src/greenlet/tests/leakcheck.py
|
||||
index a5152fb..ebe12e5 100644
|
||||
--- a/src/greenlet/tests/leakcheck.py
|
||||
+++ b/src/greenlet/tests/leakcheck.py
|
||||
@@ -30,39 +30,7 @@ import gc
|
||||
from functools import wraps
|
||||
import unittest
|
||||
|
||||
-
|
||||
-import objgraph
|
||||
-
|
||||
-# graphviz 0.18 (Nov 7 2021), available only on Python 3.6 and newer,
|
||||
-# has added type hints (sigh). It wants to use ``typing.Literal`` for
|
||||
-# some stuff, but that's only available on Python 3.9+. If that's not
|
||||
-# found, it creates a ``unittest.mock.MagicMock`` object and annotates
|
||||
-# with that. These are GC'able objects, and doing almost *anything*
|
||||
-# with them results in an explosion of objects. For example, trying to
|
||||
-# compare them for equality creates new objects. This causes our
|
||||
-# leakchecks to fail, with reports like:
|
||||
-#
|
||||
-# greenlet.tests.leakcheck.LeakCheckError: refcount increased by [337, 1333, 343, 430, 530, 643, 769]
|
||||
-# _Call 1820 +546
|
||||
-# dict 4094 +76
|
||||
-# MagicProxy 585 +73
|
||||
-# tuple 2693 +66
|
||||
-# _CallList 24 +3
|
||||
-# weakref 1441 +1
|
||||
-# function 5996 +1
|
||||
-# type 736 +1
|
||||
-# cell 592 +1
|
||||
-# MagicMock 8 +1
|
||||
-#
|
||||
-# To avoid this, we *could* filter this type of object out early. In
|
||||
-# principle it could leak, but we don't use mocks in greenlet, so it
|
||||
-# doesn't leak from us. However, a further issue is that ``MagicMock``
|
||||
-# objects have subobjects that are also GC'able, like ``_Call``, and
|
||||
-# those create new mocks of their own too. So we'd have to filter them
|
||||
-# as well, and they're not public. That's OK, we can workaround the
|
||||
-# problem by being very careful to never compare by equality or other
|
||||
-# user-defined operators, only using object identity or other builtin
|
||||
-# functions.
|
||||
+# Edited for Fedora to avoid missing dependency
|
||||
|
||||
RUNNING_ON_GITHUB_ACTIONS = os.environ.get('GITHUB_ACTIONS')
|
||||
RUNNING_ON_TRAVIS = os.environ.get('TRAVIS') or RUNNING_ON_GITHUB_ACTIONS
|
||||
@@ -74,53 +42,15 @@ SKIP_FAILING_LEAKCHECKS = os.environ.get('GREENLET_SKIP_FAILING_LEAKCHECKS')
|
||||
ONLY_FAILING_LEAKCHECKS = os.environ.get('GREENLET_ONLY_FAILING_LEAKCHECKS')
|
||||
|
||||
def ignores_leakcheck(func):
|
||||
- """
|
||||
- Ignore the given object during leakchecks.
|
||||
-
|
||||
- Can be applied to a method, in which case the method will run, but
|
||||
- will not be subject to leak checks.
|
||||
-
|
||||
- If applied to a class, the entire class will be skipped during leakchecks. This
|
||||
- is intended to be used for classes that are very slow and cause problems such as
|
||||
- test timeouts; typically it will be used for classes that are subclasses of a base
|
||||
- class and specify variants of behaviour (such as pool sizes).
|
||||
- """
|
||||
- func.ignore_leakcheck = True
|
||||
return func
|
||||
|
||||
def fails_leakcheck(func):
|
||||
- """
|
||||
- Mark that the function is known to leak.
|
||||
- """
|
||||
- func.fails_leakcheck = True
|
||||
- if SKIP_FAILING_LEAKCHECKS:
|
||||
- func = unittest.skip("Skipping known failures")(func)
|
||||
return func
|
||||
|
||||
class LeakCheckError(AssertionError):
|
||||
pass
|
||||
|
||||
-if hasattr(sys, 'getobjects'):
|
||||
- # In a Python build with ``--with-trace-refs``, make objgraph
|
||||
- # trace *all* the objects, not just those that are tracked by the
|
||||
- # GC
|
||||
- class _MockGC(object):
|
||||
- def get_objects(self):
|
||||
- return sys.getobjects(0) # pylint:disable=no-member
|
||||
- def __getattr__(self, name):
|
||||
- return getattr(gc, name)
|
||||
- objgraph.gc = _MockGC()
|
||||
- fails_strict_leakcheck = fails_leakcheck
|
||||
-else:
|
||||
- def fails_strict_leakcheck(func):
|
||||
- """
|
||||
- Decorator for a function that is known to fail when running
|
||||
- strict (``sys.getobjects()``) leakchecks.
|
||||
-
|
||||
- This type of leakcheck finds all objects, even those, such as
|
||||
- strings, which are not tracked by the garbage collector.
|
||||
- """
|
||||
- return func
|
||||
+fails_strict_leakcheck = fails_leakcheck
|
||||
|
||||
class ignores_types_in_strict_leakcheck(object):
|
||||
def __init__(self, types):
|
||||
@@ -129,191 +59,5 @@ class ignores_types_in_strict_leakcheck(object):
|
||||
func.leakcheck_ignore_types = self.types
|
||||
return func
|
||||
|
||||
-class _RefCountChecker(object):
|
||||
-
|
||||
- # Some builtin things that we ignore
|
||||
- # XXX: Those things were ignored by gevent, but they're important here,
|
||||
- # presumably.
|
||||
- IGNORED_TYPES = () #(tuple, dict, types.FrameType, types.TracebackType)
|
||||
-
|
||||
- def __init__(self, testcase, function):
|
||||
- self.testcase = testcase
|
||||
- self.function = function
|
||||
- self.deltas = []
|
||||
- self.peak_stats = {}
|
||||
- self.ignored_types = ()
|
||||
-
|
||||
- # The very first time we are called, we have already been
|
||||
- # self.setUp() by the test runner, so we don't need to do it again.
|
||||
- self.needs_setUp = False
|
||||
-
|
||||
- def _include_object_p(self, obj):
|
||||
- # pylint:disable=too-many-return-statements
|
||||
- #
|
||||
- # See the comment block at the top. We must be careful to
|
||||
- # avoid invoking user-defined operations.
|
||||
- if obj is self:
|
||||
- return False
|
||||
- kind = type(obj)
|
||||
- # ``self._include_object_p == obj`` returns NotImplemented
|
||||
- # for non-function objects, which causes the interpreter
|
||||
- # to try to reverse the order of arguments...which leads
|
||||
- # to the explosion of mock objects. We don't want that, so we implement
|
||||
- # the check manually.
|
||||
- if kind == type(self._include_object_p):
|
||||
- try:
|
||||
- # pylint:disable=not-callable
|
||||
- exact_method_equals = self._include_object_p.__eq__(obj)
|
||||
- except AttributeError:
|
||||
- # Python 2.7 methods may only have __cmp__, and that raises a
|
||||
- # TypeError for non-method arguments
|
||||
- # pylint:disable=no-member
|
||||
- exact_method_equals = self._include_object_p.__cmp__(obj) == 0
|
||||
-
|
||||
- if exact_method_equals is not NotImplemented and exact_method_equals:
|
||||
- return False
|
||||
-
|
||||
- # Similarly, we need to check identity in our __dict__ to avoid mock explosions.
|
||||
- for x in self.__dict__.values():
|
||||
- if obj is x:
|
||||
- return False
|
||||
-
|
||||
-
|
||||
- if kind in self.ignored_types or kind in self.IGNORED_TYPES:
|
||||
- return False
|
||||
-
|
||||
- return True
|
||||
-
|
||||
- def _growth(self):
|
||||
- return objgraph.growth(limit=None, peak_stats=self.peak_stats,
|
||||
- filter=self._include_object_p)
|
||||
-
|
||||
- def _report_diff(self, growth):
|
||||
- if not growth:
|
||||
- return "<Unable to calculate growth>"
|
||||
-
|
||||
- lines = []
|
||||
- width = max(len(name) for name, _, _ in growth)
|
||||
- for name, count, delta in growth:
|
||||
- lines.append('%-*s%9d %+9d' % (width, name, count, delta))
|
||||
-
|
||||
- diff = '\n'.join(lines)
|
||||
- return diff
|
||||
-
|
||||
-
|
||||
- def _run_test(self, args, kwargs):
|
||||
- gc_enabled = gc.isenabled()
|
||||
- gc.disable()
|
||||
-
|
||||
- if self.needs_setUp:
|
||||
- self.testcase.setUp()
|
||||
- self.testcase.skipTearDown = False
|
||||
- try:
|
||||
- self.function(self.testcase, *args, **kwargs)
|
||||
- finally:
|
||||
- self.testcase.tearDown()
|
||||
- self.testcase.doCleanups()
|
||||
- self.testcase.skipTearDown = True
|
||||
- self.needs_setUp = True
|
||||
- if gc_enabled:
|
||||
- gc.enable()
|
||||
-
|
||||
- def _growth_after(self):
|
||||
- # Grab post snapshot
|
||||
- # pylint:disable=no-member
|
||||
- if 'urlparse' in sys.modules:
|
||||
- sys.modules['urlparse'].clear_cache()
|
||||
- if 'urllib.parse' in sys.modules:
|
||||
- sys.modules['urllib.parse'].clear_cache()
|
||||
-
|
||||
- return self._growth()
|
||||
-
|
||||
- def _check_deltas(self, growth):
|
||||
- # Return false when we have decided there is no leak,
|
||||
- # true if we should keep looping, raises an assertion
|
||||
- # if we have decided there is a leak.
|
||||
-
|
||||
- deltas = self.deltas
|
||||
- if not deltas:
|
||||
- # We haven't run yet, no data, keep looping
|
||||
- return True
|
||||
-
|
||||
- if gc.garbage:
|
||||
- raise LeakCheckError("Generated uncollectable garbage %r" % (gc.garbage,))
|
||||
-
|
||||
-
|
||||
- # the following configurations are classified as "no leak"
|
||||
- # [0, 0]
|
||||
- # [x, 0, 0]
|
||||
- # [... a, b, c, d] where a+b+c+d = 0
|
||||
- #
|
||||
- # the following configurations are classified as "leak"
|
||||
- # [... z, z, z] where z > 0
|
||||
-
|
||||
- if deltas[-2:] == [0, 0] and len(deltas) in (2, 3):
|
||||
- return False
|
||||
-
|
||||
- if deltas[-3:] == [0, 0, 0]:
|
||||
- return False
|
||||
-
|
||||
- if len(deltas) >= 4 and sum(deltas[-4:]) == 0:
|
||||
- return False
|
||||
-
|
||||
- if len(deltas) >= 3 and deltas[-1] > 0 and deltas[-1] == deltas[-2] and deltas[-2] == deltas[-3]:
|
||||
- diff = self._report_diff(growth)
|
||||
- raise LeakCheckError('refcount increased by %r\n%s' % (deltas, diff))
|
||||
-
|
||||
- # OK, we don't know for sure yet. Let's search for more
|
||||
- if sum(deltas[-3:]) <= 0 or sum(deltas[-4:]) <= 0 or deltas[-4:].count(0) >= 2:
|
||||
- # this is suspicious, so give a few more runs
|
||||
- limit = 11
|
||||
- else:
|
||||
- limit = 7
|
||||
- if len(deltas) >= limit:
|
||||
- raise LeakCheckError('refcount increased by %r\n%s'
|
||||
- % (deltas,
|
||||
- self._report_diff(growth)))
|
||||
-
|
||||
- # We couldn't decide yet, keep going
|
||||
- return True
|
||||
-
|
||||
- def __call__(self, args, kwargs):
|
||||
- for _ in range(3):
|
||||
- gc.collect()
|
||||
-
|
||||
- expect_failure = getattr(self.function, 'fails_leakcheck', False)
|
||||
- if expect_failure:
|
||||
- self.testcase.expect_greenlet_leak = True
|
||||
- self.ignored_types = getattr(self.function, "leakcheck_ignore_types", ())
|
||||
-
|
||||
- # Capture state before; the incremental will be
|
||||
- # updated by each call to _growth_after
|
||||
- growth = self._growth()
|
||||
-
|
||||
- try:
|
||||
- while self._check_deltas(growth):
|
||||
- self._run_test(args, kwargs)
|
||||
-
|
||||
- growth = self._growth_after()
|
||||
-
|
||||
- self.deltas.append(sum((stat[2] for stat in growth)))
|
||||
- except LeakCheckError:
|
||||
- if not expect_failure:
|
||||
- raise
|
||||
- else:
|
||||
- if expect_failure:
|
||||
- raise LeakCheckError("Expected %s to leak but it did not." % (self.function,))
|
||||
-
|
||||
def wrap_refcount(method):
|
||||
- if getattr(method, 'ignore_leakcheck', False) or SKIP_LEAKCHECKS:
|
||||
- return method
|
||||
-
|
||||
- @wraps(method)
|
||||
- def wrapper(self, *args, **kwargs): # pylint:disable=too-many-branches
|
||||
- if getattr(self, 'ignore_leakcheck', False):
|
||||
- raise unittest.SkipTest("This class ignored during leakchecks")
|
||||
- if ONLY_FAILING_LEAKCHECKS and not getattr(method, 'fails_leakcheck', False):
|
||||
- raise unittest.SkipTest("Only running tests that fail leakchecks.")
|
||||
- return _RefCountChecker(self, method)(args, kwargs)
|
||||
-
|
||||
- return wrapper
|
||||
+ return method
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (greenlet-3.0.3.tar.gz) = b0aeb251e6847ab37c3d262c9e0b39d413e9e564fa7e95377d67a68970af027cc5f7d1cd5a03245855c822d94c09d2429f91c0ee1d7f36681ec2598a1d47e80e
|
||||
SHA512 (greenlet-0.4.14.tar.gz) = c86802a0df56b78482b029a0eaf624ca8f14d0e704480b30a8a35e343b3e4a16e80b6f169a970a39935b39d56aafc25bada0738199818b5892ca398a809d54ef
|
||||
|
Loading…
Reference in New Issue
Block a user