Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
6d938e37
Commit
6d938e37
authored
Oct 06, 2022
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the crashes; temporarily disable the two threaded refcount leak tests that failed.
parent
d06e0459
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
src/gevent/_compat.h
src/gevent/_compat.h
+13
-6
src/gevent/_gevent_cgreenlet.pxd
src/gevent/_gevent_cgreenlet.pxd
+3
-0
src/gevent/testing/patched_tests_setup.py
src/gevent/testing/patched_tests_setup.py
+3
-0
src/gevent/tests/test__threading_2.py
src/gevent/tests/test__threading_2.py
+1
-0
No files found.
src/gevent/_compat.h
View file @
6d938e37
...
...
@@ -14,8 +14,6 @@ extern "C" {
#if PY_VERSION_HEX >= 0x30B00A6
# define GEVENT_PY311 1
/* _PyInterpreterFrame moved to the internal C API in Python 3.11 */
# include <internal/pycore_frame.h>
#else
# define GEVENT_PY311 0
# define _PyCFrame CFrame
...
...
@@ -23,19 +21,28 @@ extern "C" {
/* FrameType and CodeType changed a lot in 3.11. */
#if GREENLET_PY311
typedef
PyObject
PyFrameObject
;
/* _PyInterpreterFrame moved to the internal C API in Python 3.11 */
# include <internal/pycore_frame.h>
#else
#include <frameobject.h>
#if PY_MAJOR_VERSION < 3 ||
PY_MINOR_VERSION < 9
#if PY_MAJOR_VERSION < 3 ||
(PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 9)
/* these were added in 3.9, though they officially became stable in 3.10 */
/* the official versions of these functions return strong references, so we
need to increment the refcount before returning, not just to match the
official functions, but to match what Cython expects an API like this to
return. Otherwise we get crashes. */
static
void
*
PyFrame_GetBack
(
PyFrameObject
*
frame
)
{
return
(
PyObject
*
)((
PyFrameObject
*
)
frame
)
->
f_back
;
PyObject
*
result
=
(
PyObject
*
)((
PyFrameObject
*
)
frame
)
->
f_back
;
Py_XINCREF
(
result
);
return
result
;
}
static
PyObject
*
PyFrame_GetCode
(
PyFrameObject
*
frame
)
{
return
(
PyObject
*
)((
PyFrameObject
*
)
frame
)
->
f_code
;
PyObject
*
result
=
(
PyObject
*
)((
PyFrameObject
*
)
frame
)
->
f_code
;
Py_XINCREF
(
result
);
return
result
;
}
#endif
/* support 3.8 and below. */
#endif
...
...
src/gevent/_gevent_cgreenlet.pxd
View file @
6d938e37
...
...
@@ -63,6 +63,9 @@ cdef extern from "_compat.h":
@
cython
.
nonecheck
(
False
)
cdef
inline
FrameType
get_f_back
(
FrameType
frame
):
# We cannot just call the original version, because it
# can return NULL even when there is no exception set. That confuses
# Cython and CPython. We need to manually check for NULL here.
f_back
=
PyFrame_GetBack
(
frame
)
if
f_back
!=
NULL
:
return
<
FrameType
>
f_back
...
...
src/gevent/testing/patched_tests_setup.py
View file @
6d938e37
...
...
@@ -118,6 +118,9 @@ def get_switch_expected(fullname):
disabled_tests = [
# XXX: While we debug latest updates. This is leaking
'
test_threading
.
ThreadTests
.
test_no_refcycle_through_target
',
# The server side takes awhile to shut down
'
test_httplib
.
HTTPSTest
.
test_local_bad_hostname
',
# These were previously 3.5+ issues (same as above)
...
...
src/gevent/tests/test__threading_2.py
View file @
6d938e37
...
...
@@ -413,6 +413,7 @@ class ThreadTests(unittest.TestCase):
if
not
hasattr
(
sys
,
'pypy_version_info'
):
def
test_no_refcycle_through_target
(
self
):
self
.
skipTest
(
'WARNING: LEAKING.Debugging.'
)
class
RunSelfFunction
(
object
):
def
__init__
(
self
,
should_raise
):
# The links in this refcycle from Thread back to self
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment