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
f04f4835
Commit
f04f4835
authored
Jan 13, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No longer reading the error.
parent
c34abdc0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
src/gevent/testing/util.py
src/gevent/testing/util.py
+1
-0
src/gevent/tests/test__monkey_module_run.py
src/gevent/tests/test__monkey_module_run.py
+6
-9
src/gevent/threadpool.py
src/gevent/threadpool.py
+5
-3
No files found.
src/gevent/testing/util.py
View file @
f04f4835
...
@@ -339,6 +339,7 @@ def _should_show_warning_output(out):
...
@@ -339,6 +339,7 @@ def _should_show_warning_output(out):
out
=
out
.
replace
(
'ImportWarning: Not importing directory'
,
'NADA'
)
out
=
out
.
replace
(
'ImportWarning: Not importing directory'
,
'NADA'
)
# Testing that U mode does the same thing
# Testing that U mode does the same thing
out
=
out
.
replace
(
"DeprecationWarning: 'U' mode is deprecated"
,
'NADA'
)
out
=
out
.
replace
(
"DeprecationWarning: 'U' mode is deprecated"
,
'NADA'
)
out
=
out
.
replace
(
"DeprecationWarning: dns.hash module"
,
'NADA'
)
return
'Warning'
in
out
return
'Warning'
in
out
output_lock
=
threading
.
Lock
()
output_lock
=
threading
.
Lock
()
...
...
src/gevent/tests/test__monkey_module_run.py
View file @
f04f4835
...
@@ -66,13 +66,13 @@ class TestRun(greentest.TestCase):
...
@@ -66,13 +66,13 @@ class TestRun(greentest.TestCase):
self
.
assertEqual
(
monkey_out_lines
,
std_out_lines
)
self
.
assertEqual
(
monkey_out_lines
,
std_out_lines
)
self
.
assertEqual
(
monkey_result
.
error
,
std_result
.
error
)
self
.
assertEqual
(
monkey_result
.
error
,
std_result
.
error
)
return
monkey_out_lines
,
monkey_result
.
error
return
monkey_out_lines
def
test_run_simple
(
self
):
def
test_run_simple
(
self
):
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'script.py'
))
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'script.py'
))
def
_run_package
(
self
,
module
):
def
_run_package
(
self
,
module
):
lines
,
_
=
self
.
_run
(
'monkey_package'
,
module
=
module
)
lines
=
self
.
_run
(
'monkey_package'
,
module
=
module
)
self
.
assertTrue
(
lines
[
0
].
endswith
(
u'__main__.py'
),
lines
[
0
])
self
.
assertTrue
(
lines
[
0
].
endswith
(
u'__main__.py'
),
lines
[
0
])
self
.
assertEqual
(
lines
[
1
].
strip
(),
u'__main__'
)
self
.
assertEqual
(
lines
[
1
].
strip
(),
u'__main__'
)
...
@@ -86,7 +86,7 @@ class TestRun(greentest.TestCase):
...
@@ -86,7 +86,7 @@ class TestRun(greentest.TestCase):
self
.
_run_package
(
module
=
True
)
self
.
_run_package
(
module
=
True
)
def
test_issue_302
(
self
):
def
test_issue_302
(
self
):
lines
,
_
=
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'issue302monkey.py'
))
lines
=
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'issue302monkey.py'
))
self
.
assertEqual
(
lines
[
0
].
strip
(),
u'True'
)
self
.
assertEqual
(
lines
[
0
].
strip
(),
u'True'
)
lines
[
1
]
=
lines
[
1
].
replace
(
u'
\
\
'
,
u'/'
)
# windows path
lines
[
1
]
=
lines
[
1
].
replace
(
u'
\
\
'
,
u'/'
)
# windows path
...
@@ -108,25 +108,22 @@ class TestRun(greentest.TestCase):
...
@@ -108,25 +108,22 @@ class TestRun(greentest.TestCase):
def
test_threadpool_in_patched_after_patch
(
self
):
def
test_threadpool_in_patched_after_patch
(
self
):
# Issue 1484
# Issue 1484
# If we don't have this correct, then we get exceptions
# If we don't have this correct, then we get exceptions
out
,
err
=
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'threadpool_monkey_patches.py'
))
out
=
self
.
_run
(
os
.
path
.
join
(
'monkey_package'
,
'threadpool_monkey_patches.py'
))
self
.
assertEqual
(
out
,
[
'False'
,
'2'
])
self
.
assertEqual
(
out
,
[
'False'
,
'2'
])
self
.
assertEqual
(
err
,
b''
)
@
greentest
.
skipOnPy2
(
"lost sys.stderr sometimes"
)
@
greentest
.
skipOnPy2
(
"lost sys.stderr sometimes"
)
def
test_threadpool_in_patched_after_patch_module
(
self
):
def
test_threadpool_in_patched_after_patch_module
(
self
):
# Issue 1484
# Issue 1484
# If we don't have this correct, then we get exceptions
# If we don't have this correct, then we get exceptions
out
,
err
=
self
.
_run
(
'monkey_package.threadpool_monkey_patches'
,
module
=
True
)
out
=
self
.
_run
(
'monkey_package.threadpool_monkey_patches'
,
module
=
True
)
self
.
assertEqual
(
out
,
[
'False'
,
'2'
])
self
.
assertEqual
(
out
,
[
'False'
,
'2'
])
self
.
assertEqual
(
err
,
b''
)
@
greentest
.
skipOnPy2
(
"lost sys.stderr sometimes"
)
@
greentest
.
skipOnPy2
(
"lost sys.stderr sometimes"
)
def
test_threadpool_not_patched_after_patch_module
(
self
):
def
test_threadpool_not_patched_after_patch_module
(
self
):
# Issue 1484
# Issue 1484
# If we don't have this correct, then we get exceptions
# If we don't have this correct, then we get exceptions
out
,
err
=
self
.
_run
(
'monkey_package.threadpool_no_monkey'
,
module
=
True
)
out
=
self
.
_run
(
'monkey_package.threadpool_no_monkey'
,
module
=
True
)
self
.
assertEqual
(
out
,
[
'False'
,
'False'
,
'2'
])
self
.
assertEqual
(
out
,
[
'False'
,
'False'
,
'2'
])
self
.
assertEqual
(
err
,
b''
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
greentest
.
main
()
greentest
.
main
()
src/gevent/threadpool.py
View file @
f04f4835
...
@@ -86,11 +86,13 @@ class _WorkerGreenlet(RawGreenlet):
...
@@ -86,11 +86,13 @@ class _WorkerGreenlet(RawGreenlet):
self
.
_unregister_worker
(
self
)
self
.
_unregister_worker
(
self
)
raise
raise
def
_begin
(
self
):
def
_begin
(
self
,
_get_c
=
getcurrent
,
_get_ti
=
get_thread_ident
):
# Pass arguments to avoid accessing globals during module shutdown.
# we're in the new thread (but its root greenlet). Establish invariants and get going
# we're in the new thread (but its root greenlet). Establish invariants and get going
# by making this the current greenlet.
# by making this the current greenlet.
self
.
parent
=
getcurrent
()
# pylint:disable=attribute-defined-outside-init
self
.
parent
=
_get_c
()
# pylint:disable=attribute-defined-outside-init
self
.
_thread_ident
=
get_thread_ident
()
self
.
_thread_ident
=
_get_ti
()
# ignore the parent attribute. (We can't set parent to None.)
# ignore the parent attribute. (We can't set parent to None.)
self
.
parent
.
greenlet_tree_is_ignored
=
True
self
.
parent
.
greenlet_tree_is_ignored
=
True
try
:
try
:
...
...
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