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
af002e64
Commit
af002e64
authored
Oct 18, 2013
by
Brett Cannon
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
27e27f7e
44455e8d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
49 deletions
+43
-49
Lib/asyncio/proactor_events.py
Lib/asyncio/proactor_events.py
+3
-3
Lib/asyncio/selector_events.py
Lib/asyncio/selector_events.py
+7
-7
Lib/asyncio/streams.py
Lib/asyncio/streams.py
+2
-2
Lib/asyncio/transports.py
Lib/asyncio/transports.py
+3
-3
Lib/asyncio/unix_events.py
Lib/asyncio/unix_events.py
+2
-2
Lib/test/test_asyncio/test_events.py
Lib/test/test_asyncio/test_events.py
+1
-1
Lib/test/test_asyncio/test_proactor_events.py
Lib/test/test_asyncio/test_proactor_events.py
+3
-3
Lib/test/test_asyncio/test_selector_events.py
Lib/test/test_asyncio/test_selector_events.py
+6
-6
Lib/test/test_asyncio/test_transports.py
Lib/test/test_asyncio/test_transports.py
+2
-2
Lib/test/test_asyncio/test_unix_events.py
Lib/test/test_asyncio/test_unix_events.py
+4
-4
PCbuild/pcbuild.sln
PCbuild/pcbuild.sln
+10
-16
No files found.
Lib/asyncio/proactor_events.py
View file @
af002e64
...
...
@@ -94,12 +94,12 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport,
self
.
_paused
=
False
self
.
_loop
.
call_soon
(
self
.
_loop_reading
)
def
pause
(
self
):
assert
not
self
.
_closing
,
'Cannot pause() when closing'
def
pause
_reading
(
self
):
assert
not
self
.
_closing
,
'Cannot pause
_reading
() when closing'
assert
not
self
.
_paused
,
'Already paused'
self
.
_paused
=
True
def
resume
(
self
):
def
resume
_reading
(
self
):
assert
self
.
_paused
,
'Not paused'
self
.
_paused
=
False
if
self
.
_closing
:
...
...
Lib/asyncio/selector_events.py
View file @
af002e64
...
...
@@ -406,13 +406,13 @@ class _SelectorSocketTransport(_SelectorTransport):
if
waiter
is
not
None
:
self
.
_loop
.
call_soon
(
waiter
.
set_result
,
None
)
def
pause
(
self
):
assert
not
self
.
_closing
,
'Cannot pause() when closing'
def
pause
_reading
(
self
):
assert
not
self
.
_closing
,
'Cannot pause
_reading
() when closing'
assert
not
self
.
_paused
,
'Already paused'
self
.
_paused
=
True
self
.
_loop
.
remove_reader
(
self
.
_sock_fd
)
def
resume
(
self
):
def
resume
_reading
(
self
):
assert
self
.
_paused
,
'Not paused'
self
.
_paused
=
False
if
self
.
_closing
:
...
...
@@ -590,19 +590,19 @@ class _SelectorSslTransport(_SelectorTransport):
if
self
.
_waiter
is
not
None
:
self
.
_loop
.
call_soon
(
self
.
_waiter
.
set_result
,
None
)
def
pause
(
self
):
def
pause
_reading
(
self
):
# XXX This is a bit icky, given the comment at the top of
# _on_ready(). Is it possible to evoke a deadlock? I don't
# know, although it doesn't look like it; write() will still
# accept more data for the buffer and eventually the app will
# call resume() again, and things will flow again.
# call resume
_reading
() again, and things will flow again.
assert
not
self
.
_closing
,
'Cannot pause() when closing'
assert
not
self
.
_closing
,
'Cannot pause
_reading
() when closing'
assert
not
self
.
_paused
,
'Already paused'
self
.
_paused
=
True
self
.
_loop
.
remove_reader
(
self
.
_sock_fd
)
def
resume
(
self
):
def
resume
_reading
(
self
):
assert
self
.
_paused
,
'Not paused'
self
.
_paused
=
False
if
self
.
_closing
:
...
...
Lib/asyncio/streams.py
View file @
af002e64
...
...
@@ -106,7 +106,7 @@ class StreamReader:
def
_maybe_resume_transport
(
self
):
if
self
.
_paused
and
self
.
byte_count
<=
self
.
limit
:
self
.
_paused
=
False
self
.
_transport
.
resume
()
self
.
_transport
.
resume
_reading
()
def
feed_eof
(
self
):
self
.
eof
=
True
...
...
@@ -133,7 +133,7 @@ class StreamReader:
not
self
.
_paused
and
self
.
byte_count
>
2
*
self
.
limit
):
try
:
self
.
_transport
.
pause
()
self
.
_transport
.
pause
_reading
()
except
NotImplementedError
:
# The transport can't be paused.
# We'll just have to buffer all data.
...
...
Lib/asyncio/transports.py
View file @
af002e64
...
...
@@ -29,15 +29,15 @@ class BaseTransport:
class
ReadTransport
(
BaseTransport
):
"""ABC for read-only transports."""
def
pause
(
self
):
def
pause
_reading
(
self
):
"""Pause the receiving end.
No data will be passed to the protocol's data_received()
method until resume() is called.
method until resume
_reading
() is called.
"""
raise
NotImplementedError
def
resume
(
self
):
def
resume
_reading
(
self
):
"""Resume the receiving end.
Data received will once again be passed to the protocol's
...
...
Lib/asyncio/unix_events.py
View file @
af002e64
...
...
@@ -232,10 +232,10 @@ class _UnixReadPipeTransport(transports.ReadTransport):
self
.
_loop
.
call_soon
(
self
.
_protocol
.
eof_received
)
self
.
_loop
.
call_soon
(
self
.
_call_connection_lost
,
None
)
def
pause
(
self
):
def
pause
_reading
(
self
):
self
.
_loop
.
remove_reader
(
self
.
_fileno
)
def
resume
(
self
):
def
resume
_reading
(
self
):
self
.
_loop
.
add_reader
(
self
.
_fileno
,
self
.
_read_ready
)
def
close
(
self
):
...
...
Lib/test/test_asyncio/test_events.py
View file @
af002e64
...
...
@@ -238,7 +238,7 @@ class EventLoopTestsMixin:
self
.
loop
.
run_forever
()
t1
=
time
.
monotonic
()
self
.
assertEqual
(
results
,
[
'hello world'
])
self
.
assertTrue
(
0.0
9
<=
t1
-
t0
<=
0.1
2
,
t1
-
t0
)
self
.
assertTrue
(
0.0
8
<=
t1
-
t0
<=
0.
2
,
t1
-
t0
)
def
test_call_soon
(
self
):
results
=
[]
...
...
Lib/test/test_asyncio/test_proactor_events.py
View file @
af002e64
...
...
@@ -308,7 +308,7 @@ class ProactorSocketTransportTests(unittest.TestCase):
tr
.
write_eof
()
tr
.
close
()
def
test_pause_resume
(
self
):
def
test_pause_resume
_reading
(
self
):
tr
=
_ProactorSocketTransport
(
self
.
loop
,
self
.
sock
,
self
.
protocol
)
futures
=
[]
...
...
@@ -323,12 +323,12 @@ class ProactorSocketTransportTests(unittest.TestCase):
self
.
protocol
.
data_received
.
assert_called_with
(
b'data1'
)
self
.
loop
.
_run_once
()
self
.
protocol
.
data_received
.
assert_called_with
(
b'data2'
)
tr
.
pause
()
tr
.
pause
_reading
()
self
.
assertTrue
(
tr
.
_paused
)
for
i
in
range
(
10
):
self
.
loop
.
_run_once
()
self
.
protocol
.
data_received
.
assert_called_with
(
b'data2'
)
tr
.
resume
()
tr
.
resume
_reading
()
self
.
assertFalse
(
tr
.
_paused
)
self
.
loop
.
_run_once
()
self
.
protocol
.
data_received
.
assert_called_with
(
b'data3'
)
...
...
Lib/test/test_asyncio/test_selector_events.py
View file @
af002e64
...
...
@@ -676,15 +676,15 @@ class SelectorSocketTransportTests(unittest.TestCase):
test_utils
.
run_briefly
(
self
.
loop
)
self
.
assertIsNone
(
fut
.
result
())
def
test_pause_resume
(
self
):
def
test_pause_resume
_reading
(
self
):
tr
=
_SelectorSocketTransport
(
self
.
loop
,
self
.
sock
,
self
.
protocol
)
self
.
assertFalse
(
tr
.
_paused
)
self
.
loop
.
assert_reader
(
7
,
tr
.
_read_ready
)
tr
.
pause
()
tr
.
pause
_reading
()
self
.
assertTrue
(
tr
.
_paused
)
self
.
assertFalse
(
7
in
self
.
loop
.
readers
)
tr
.
resume
()
tr
.
resume
_reading
()
self
.
assertFalse
(
tr
.
_paused
)
self
.
loop
.
assert_reader
(
7
,
tr
.
_read_ready
)
...
...
@@ -1044,14 +1044,14 @@ class SelectorSslTransportTests(unittest.TestCase):
self
.
assertTrue
(
transport
.
_waiter
.
done
())
self
.
assertIs
(
exc
,
transport
.
_waiter
.
exception
())
def
test_pause_resume
(
self
):
def
test_pause_resume
_reading
(
self
):
tr
=
self
.
_make_one
()
self
.
assertFalse
(
tr
.
_paused
)
self
.
loop
.
assert_reader
(
1
,
tr
.
_on_ready
)
tr
.
pause
()
tr
.
pause
_reading
()
self
.
assertTrue
(
tr
.
_paused
)
self
.
assertFalse
(
1
in
self
.
loop
.
readers
)
tr
.
resume
()
tr
.
resume
_reading
()
self
.
assertFalse
(
tr
.
_paused
)
self
.
loop
.
assert_reader
(
1
,
tr
.
_on_ready
)
...
...
Lib/test/test_asyncio/test_transports.py
View file @
af002e64
...
...
@@ -33,8 +33,8 @@ class TransportTests(unittest.TestCase):
self
.
assertRaises
(
NotImplementedError
,
transport
.
write
,
'data'
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
write_eof
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
can_write_eof
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
pause
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
resume
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
pause
_reading
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
resume
_reading
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
close
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
abort
)
...
...
Lib/test/test_asyncio/test_unix_events.py
View file @
af002e64
...
...
@@ -375,21 +375,21 @@ class UnixReadPipeTransportTests(unittest.TestCase):
m_logexc
.
assert_called_with
(
'Fatal error for %s'
,
tr
)
@
unittest
.
mock
.
patch
(
'os.read'
)
def
test_pause
(
self
,
m_read
):
def
test_pause
_reading
(
self
,
m_read
):
tr
=
unix_events
.
_UnixReadPipeTransport
(
self
.
loop
,
self
.
pipe
,
self
.
protocol
)
m
=
unittest
.
mock
.
Mock
()
self
.
loop
.
add_reader
(
5
,
m
)
tr
.
pause
()
tr
.
pause
_reading
()
self
.
assertFalse
(
self
.
loop
.
readers
)
@
unittest
.
mock
.
patch
(
'os.read'
)
def
test_resume
(
self
,
m_read
):
def
test_resume
_reading
(
self
,
m_read
):
tr
=
unix_events
.
_UnixReadPipeTransport
(
self
.
loop
,
self
.
pipe
,
self
.
protocol
)
tr
.
resume
()
tr
.
resume
_reading
()
self
.
loop
.
assert_reader
(
5
,
tr
.
_read_ready
)
@
unittest
.
mock
.
patch
(
'os.read'
)
...
...
PCbuild/pcbuild.sln
View file @
af002e64
...
...
@@ -154,22 +154,6 @@ Global
{F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32
{F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64
{F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.Build.0 = PGInstrument|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.Build.0 = PGUpdate|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64
{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64
{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32
{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32
{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32
...
...
@@ -647,6 +631,16 @@ Global
{254A0C05-6696-4B08-8CB2-EF7D533AEE01}.Release|Win32.Build.0 = Release|Win32
{254A0C05-6696-4B08-8CB2-EF7D533AEE01}.Release|x64.ActiveCfg = Release|x64
{254A0C05-6696-4B08-8CB2-EF7D533AEE01}.Release|x64.Build.0 = Release|x64
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Debug|Win32.ActiveCfg = Debug|Win32
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Debug|x64.ActiveCfg = Debug|x64
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Release|Win32.ActiveCfg = Release|Win32
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Release|Win32.Build.0 = Release|Win32
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Release|x64.ActiveCfg = Release|x64
{EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
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