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
cc576fd4
Commit
cc576fd4
authored
Jun 30, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the leakchecks with a couple well-placed del statements.
parent
8f579d78
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
11 deletions
+25
-11
gevent/_tblib.py
gevent/_tblib.py
+4
-1
gevent/greenlet.py
gevent/greenlet.py
+9
-3
greentest/greentest.py
greentest/greentest.py
+11
-5
greentest/test__greenlet.py
greentest/test__greenlet.py
+1
-1
greentest/test__threadpool.py
greentest/test__threadpool.py
+0
-1
No files found.
gevent/_tblib.py
View file @
cc576fd4
...
@@ -185,7 +185,10 @@ class Traceback(object):
...
@@ -185,7 +185,10 @@ class Traceback(object):
except
:
except
:
tb
=
sys
.
exc_info
()[
2
].
tb_next
tb
=
sys
.
exc_info
()[
2
].
tb_next
tb_set_next
(
tb
,
self
.
tb_next
and
self
.
tb_next
.
as_traceback
())
tb_set_next
(
tb
,
self
.
tb_next
and
self
.
tb_next
.
as_traceback
())
return
tb
try
:
return
tb
finally
:
del
tb
else
:
else
:
raise
RuntimeError
(
"Cannot re-create traceback !"
)
raise
RuntimeError
(
"Cannot re-create traceback !"
)
...
...
gevent/greenlet.py
View file @
cc576fd4
...
@@ -121,6 +121,9 @@ class Greenlet(greenlet):
...
@@ -121,6 +121,9 @@ class Greenlet(greenlet):
def
_links
(
self
):
def
_links
(
self
):
return
deque
()
return
deque
()
def
_has_links
(
self
):
return
'_links'
in
self
.
__dict__
and
self
.
_links
def
_raise_exception
(
self
):
def
_raise_exception
(
self
):
reraise
(
*
self
.
exc_info
)
reraise
(
*
self
.
exc_info
)
...
@@ -351,7 +354,7 @@ class Greenlet(greenlet):
...
@@ -351,7 +354,7 @@ class Greenlet(greenlet):
def
_report_result
(
self
,
result
):
def
_report_result
(
self
,
result
):
self
.
_exc_info
=
(
None
,
None
,
None
)
self
.
_exc_info
=
(
None
,
None
,
None
)
self
.
value
=
result
self
.
value
=
result
if
self
.
_
links
and
not
self
.
_notifier
:
if
self
.
_
has_links
()
and
not
self
.
_notifier
:
self
.
_notifier
=
self
.
parent
.
loop
.
run_callback
(
self
.
_notify_links
)
self
.
_notifier
=
self
.
parent
.
loop
.
run_callback
(
self
.
_notify_links
)
def
_report_error
(
self
,
exc_info
):
def
_report_error
(
self
,
exc_info
):
...
@@ -361,10 +364,13 @@ class Greenlet(greenlet):
...
@@ -361,10 +364,13 @@ class Greenlet(greenlet):
self
.
_exc_info
=
exc_info
[
0
],
exc_info
[
1
],
dump_traceback
(
exc_info
[
2
])
self
.
_exc_info
=
exc_info
[
0
],
exc_info
[
1
],
dump_traceback
(
exc_info
[
2
])
if
self
.
_
links
and
not
self
.
_notifier
:
if
self
.
_
has_links
()
and
not
self
.
_notifier
:
self
.
_notifier
=
self
.
parent
.
loop
.
run_callback
(
self
.
_notify_links
)
self
.
_notifier
=
self
.
parent
.
loop
.
run_callback
(
self
.
_notify_links
)
self
.
parent
.
handle_error
(
self
,
*
exc_info
)
try
:
self
.
parent
.
handle_error
(
self
,
*
exc_info
)
finally
:
del
exc_info
def
run
(
self
):
def
run
(
self
):
try
:
try
:
...
...
greentest/greentest.py
View file @
cc576fd4
...
@@ -47,6 +47,8 @@ else:
...
@@ -47,6 +47,8 @@ else:
gettotalrefcount
=
getattr
(
sys
,
'gettotalrefcount'
,
None
)
gettotalrefcount
=
getattr
(
sys
,
'gettotalrefcount'
,
None
)
OPTIONAL_MODULES
=
[
'resolver_ares'
]
OPTIONAL_MODULES
=
[
'resolver_ares'
]
class
ExpectedException
(
Exception
):
"""An exception whose traceback should be ignored"""
def
wrap_switch_count_check
(
method
):
def
wrap_switch_count_check
(
method
):
@
wraps
(
method
)
@
wraps
(
method
)
...
@@ -93,7 +95,7 @@ def wrap_refcount(method):
...
@@ -93,7 +95,7 @@ def wrap_refcount(method):
return
method
return
method
# Some builtin things that we ignore
# Some builtin things that we ignore
IGNORED_TYPES
=
(
tuple
,
dict
,
types
.
FrameType
)
IGNORED_TYPES
=
(
tuple
,
dict
,
types
.
FrameType
,
types
.
TracebackType
)
def
type_hist
():
def
type_hist
():
import
collections
import
collections
...
@@ -328,12 +330,20 @@ _original_Hub = gevent.hub.Hub
...
@@ -328,12 +330,20 @@ _original_Hub = gevent.hub.Hub
class
CountingHub
(
_original_Hub
):
class
CountingHub
(
_original_Hub
):
EXPECTED_TEST_ERROR
=
(
ExpectedException
,)
switch_count
=
0
switch_count
=
0
def
switch
(
self
,
*
args
):
def
switch
(
self
,
*
args
):
self
.
switch_count
+=
1
self
.
switch_count
+=
1
return
_original_Hub
.
switch
(
self
,
*
args
)
return
_original_Hub
.
switch
(
self
,
*
args
)
def
handle_error
(
self
,
context
,
type
,
value
,
tb
):
if
issubclass
(
type
,
self
.
EXPECTED_TEST_ERROR
):
# Don't print these to cut down on the noise in the test logs
return
return
_original_Hub
.
handle_error
(
self
,
context
,
type
,
value
,
tb
)
if
gettotalrefcount
is
None
:
if
gettotalrefcount
is
None
:
gevent
.
hub
.
Hub
=
CountingHub
gevent
.
hub
.
Hub
=
CountingHub
...
@@ -411,10 +421,6 @@ class GenericGetTestCase(TestCase):
...
@@ -411,10 +421,6 @@ class GenericGetTestCase(TestCase):
self
.
cleanup
()
self
.
cleanup
()
class
ExpectedException
(
Exception
):
"""An exception whose traceback should be ignored"""
def
walk_modules
(
basedir
=
None
,
modpath
=
None
,
include_so
=
False
,
recursive
=
False
):
def
walk_modules
(
basedir
=
None
,
modpath
=
None
,
include_so
=
False
,
recursive
=
False
):
if
PYPY
:
if
PYPY
:
include_so
=
False
include_so
=
False
...
...
greentest/test__greenlet.py
View file @
cc576fd4
...
@@ -32,7 +32,7 @@ DELAY = 0.01
...
@@ -32,7 +32,7 @@ DELAY = 0.01
greentest
.
TestCase
.
error_fatal
=
False
greentest
.
TestCase
.
error_fatal
=
False
class
ExpectedError
(
Exception
):
class
ExpectedError
(
greentest
.
Expected
Exception
):
pass
pass
...
...
greentest/test__threadpool.py
View file @
cc576fd4
...
@@ -57,7 +57,6 @@ class PoolBasicTests(TestCase):
...
@@ -57,7 +57,6 @@ class PoolBasicTests(TestCase):
try
:
try
:
pool
.
apply
(
raiser
)
pool
.
apply
(
raiser
)
except
ExpectedException
:
except
ExpectedException
:
import
traceback
;
traceback
.
print_exc
()
pass
pass
else
:
else
:
self
.
fail
(
"Should have raised ExpectedException"
)
self
.
fail
(
"Should have raised ExpectedException"
)
...
...
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