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
db623899
Commit
db623899
authored
May 16, 2018
by
Jason Madden
Committed by
GitHub
May 16, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1214 from gevent/issue1211
Let Event have weak references.
parents
e6d9991e
368d6a91
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
3 deletions
+23
-3
CHANGES.rst
CHANGES.rst
+2
-1
src/gevent/_event.pxd
src/gevent/_event.pxd
+5
-1
src/gevent/event.py
src/gevent/event.py
+1
-1
src/greentest/greentest/__init__.py
src/greentest/greentest/__init__.py
+1
-0
src/greentest/greentest/skipping.py
src/greentest/greentest/skipping.py
+2
-0
src/greentest/test__event.py
src/greentest/test__event.py
+12
-0
No files found.
CHANGES.rst
View file @
db623899
...
...
@@ -7,7 +7,8 @@
1.3.1 (unreleased)
==================
- Nothing changed yet.
- Fix weak references to :class:`gevent.event.Event`. Reported in
:issue:`1211` by Matias Guijarro.
- Fix embedded uses of :func:`gevent.Greenlet.spawn`, especially under
uwsgi. Reported in :issue:`1212` by Kunal Gangakhedkar.
...
...
src/gevent/_event.pxd
View file @
db623899
...
...
@@ -36,6 +36,11 @@ cdef inline void greenlet_init():
cdef
void
_init
()
cdef
class
_AbstractLinkable
:
# We declare the __weakref__ here in the base (even though
# that's not really what we want) as a workaround for a Cython
# issue we see reliably on 3.7b4 and sometimes on 3.6. See
# https://github.com/cython/cython/issues/2270
cdef
object
__weakref__
cdef
_notifier
cdef
set
_links
cdef
readonly
SwitchOutGreenletWithLoop
hub
...
...
@@ -55,7 +60,6 @@ cdef class _AbstractLinkable:
cdef
class
Event
(
_AbstractLinkable
):
cdef
bint
_flag
cdef
class
AsyncResult
(
_AbstractLinkable
):
cdef
readonly
_value
cdef
readonly
tuple
_exc_info
...
...
src/gevent/event.py
View file @
db623899
...
...
@@ -157,7 +157,7 @@ class Event(_AbstractLinkable):
the waiting greenlets being awakened. These details may change in the future.
"""
__slots__
=
(
'_flag'
,)
__slots__
=
(
'_flag'
,
'__weakref__'
)
def
__init__
(
self
):
_AbstractLinkable
.
__init__
(
self
)
...
...
src/greentest/greentest/__init__.py
View file @
db623899
...
...
@@ -78,6 +78,7 @@ from greentest.skipping import skipOnLibuvOnPyPyOnWin
from
greentest.skipping
import
skipOnPurePython
from
greentest.skipping
import
skipWithCExtensions
from
greentest.skipping
import
skipOnLibuvOnTravisOnCPython27
from
greentest.skipping
import
skipOnPy37
from
greentest.exception
import
ExpectedException
...
...
src/greentest/greentest/skipping.py
View file @
db623899
...
...
@@ -41,6 +41,8 @@ skipOnPyPy3OnCI = _do_not_skip
skipOnPyPy3
=
_do_not_skip
skipOnPyPyOnWindows
=
_do_not_skip
skipOnPy37
=
unittest
.
skip
if
sysinfo
.
PY37
else
_do_not_skip
skipOnPurePython
=
unittest
.
skip
if
sysinfo
.
PURE_PYTHON
else
_do_not_skip
skipWithCExtensions
=
unittest
.
skip
if
not
sysinfo
.
PURE_PYTHON
else
_do_not_skip
...
...
src/greentest/test__event.py
View file @
db623899
from
__future__
import
absolute_import
,
print_function
,
division
import
weakref
import
gevent
from
gevent.event
import
Event
,
AsyncResult
...
...
@@ -234,6 +236,16 @@ class TestWait_count1(TestWait):
class
TestWait_count2
(
TestWait
):
count
=
2
class
TestEventBasics
(
greentest
.
TestCase
):
def
test_weakref
(
self
):
# Event objects should allow weakrefs
e
=
Event
()
r
=
weakref
.
ref
(
e
)
self
.
assertIs
(
e
,
r
())
del
e
del
r
del
AbstractGenericGetTestCase
del
AbstractGenericWaitTestCase
...
...
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