Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7b7120e1
Commit
7b7120e1
authored
Jun 23, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asyncio: Enable the debug mode of event loops when the PYTHONASYNCIODEBUG
environment variable is set
parent
d6de5d84
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
14 deletions
+11
-14
Doc/library/asyncio-eventloop.rst
Doc/library/asyncio-eventloop.rst
+5
-1
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+2
-1
Lib/test/test_asyncio/test_selector_events.py
Lib/test/test_asyncio/test_selector_events.py
+0
-2
Lib/test/test_asyncio/test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+2
-2
Lib/test/test_asyncio/test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+2
-0
Lib/test/test_asyncio/test_unix_events.py
Lib/test/test_asyncio/test_unix_events.py
+0
-8
No files found.
Doc/library/asyncio-eventloop.rst
View file @
7b7120e1
...
...
@@ -585,7 +585,11 @@ Debug mode
.. method:: BaseEventLoop.get_debug()
Get the debug mode (:class:`bool`) of the event loop, ``False`` by default.
Get the debug mode (:class:`bool`) of the event loop.
The default value is ``True`` if the environment variable
:envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False``
otherwise.
.. versionadded:: 3.4.2
...
...
Lib/asyncio/base_events.py
View file @
7b7120e1
...
...
@@ -137,7 +137,8 @@ class BaseEventLoop(events.AbstractEventLoop):
self
.
_running
=
False
self
.
_clock_resolution
=
time
.
get_clock_info
(
'monotonic'
).
resolution
self
.
_exception_handler
=
None
self
.
_debug
=
False
self
.
_debug
=
(
not
sys
.
flags
.
ignore_environment
and
bool
(
os
.
environ
.
get
(
'PYTHONASYNCIODEBUG'
)))
# In debug mode, if the execution of a callback or a step of a task
# exceed this duration in seconds, the slow callback/task is logged.
self
.
slow_callback_duration
=
0.1
...
...
Lib/test/test_asyncio/test_selector_events.py
View file @
7b7120e1
...
...
@@ -682,8 +682,6 @@ class SelectorTransportTests(test_utils.TestCase):
self
.
assertEqual
(
2
,
sys
.
getrefcount
(
self
.
protocol
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
protocol
)))
self
.
assertIsNone
(
tr
.
_loop
)
self
.
assertEqual
(
3
,
sys
.
getrefcount
(
self
.
loop
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
loop
)))
class
SelectorSocketTransportTests
(
test_utils
.
TestCase
):
...
...
Lib/test/test_asyncio/test_subprocess.py
View file @
7b7120e1
...
...
@@ -141,7 +141,7 @@ if sys.platform != 'win32':
policy
=
asyncio
.
get_event_loop_policy
()
self
.
loop
=
policy
.
new_event_loop
()
# ensure that the event loop is passed explicitly in
the code
# ensure that the event loop is passed explicitly in
asyncio
policy
.
set_event_loop
(
None
)
watcher
=
self
.
Watcher
()
...
...
@@ -172,7 +172,7 @@ else:
policy
=
asyncio
.
get_event_loop_policy
()
self
.
loop
=
asyncio
.
ProactorEventLoop
()
# ensure that the event loop is passed explicitly in
the code
# ensure that the event loop is passed explicitly in
asyncio
policy
.
set_event_loop
(
None
)
def
tearDown
(
self
):
...
...
Lib/test/test_asyncio/test_tasks.py
View file @
7b7120e1
...
...
@@ -1712,6 +1712,8 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
self
.
assertIs
(
fut
.
_loop
,
self
.
one_loop
)
gen1
.
close
()
gen2
.
close
()
self
.
set_event_loop
(
self
.
other_loop
,
cleanup
=
False
)
gen3
=
coro
()
gen4
=
coro
()
fut
=
asyncio
.
gather
(
gen3
,
gen4
,
loop
=
self
.
other_loop
)
...
...
Lib/test/test_asyncio/test_unix_events.py
View file @
7b7120e1
...
...
@@ -445,8 +445,6 @@ class UnixReadPipeTransportTests(test_utils.TestCase):
self
.
assertEqual
(
2
,
sys
.
getrefcount
(
self
.
protocol
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
protocol
)))
self
.
assertIsNone
(
tr
.
_loop
)
self
.
assertEqual
(
5
,
sys
.
getrefcount
(
self
.
loop
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
loop
)))
def
test__call_connection_lost_with_err
(
self
):
tr
=
unix_events
.
_UnixReadPipeTransport
(
...
...
@@ -462,8 +460,6 @@ class UnixReadPipeTransportTests(test_utils.TestCase):
self
.
assertEqual
(
2
,
sys
.
getrefcount
(
self
.
protocol
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
protocol
)))
self
.
assertIsNone
(
tr
.
_loop
)
self
.
assertEqual
(
5
,
sys
.
getrefcount
(
self
.
loop
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
loop
)))
class
UnixWritePipeTransportTests
(
test_utils
.
TestCase
):
...
...
@@ -731,8 +727,6 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
self
.
assertEqual
(
2
,
sys
.
getrefcount
(
self
.
protocol
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
protocol
)))
self
.
assertIsNone
(
tr
.
_loop
)
self
.
assertEqual
(
5
,
sys
.
getrefcount
(
self
.
loop
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
loop
)))
def
test__call_connection_lost_with_err
(
self
):
tr
=
unix_events
.
_UnixWritePipeTransport
(
...
...
@@ -747,8 +741,6 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
self
.
assertEqual
(
2
,
sys
.
getrefcount
(
self
.
protocol
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
protocol
)))
self
.
assertIsNone
(
tr
.
_loop
)
self
.
assertEqual
(
5
,
sys
.
getrefcount
(
self
.
loop
),
pprint
.
pformat
(
gc
.
get_referrers
(
self
.
loop
)))
def
test_close
(
self
):
tr
=
unix_events
.
_UnixWritePipeTransport
(
...
...
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