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
bca4939d
Commit
bca4939d
authored
Sep 03, 2017
by
Serhiy Storchaka
Committed by
GitHub
Sep 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076)
parent
8df44ee8
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
248 additions
and
219 deletions
+248
-219
Lib/test/test_asyncio/test_futures.py
Lib/test/test_asyncio/test_futures.py
+37
-8
Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst
...S.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst
+1
-0
Modules/_asynciomodule.c
Modules/_asynciomodule.c
+206
-207
Modules/clinic/_asynciomodule.c.h
Modules/clinic/_asynciomodule.c.h
+4
-4
No files found.
Lib/test/test_asyncio/test_futures.py
View file @
bca4939d
...
...
@@ -100,8 +100,8 @@ class DuckTests(test_utils.TestCase):
class
BaseFutureTests
:
def
_new_future
(
self
,
loop
=
None
):
r
aise
NotImplementedError
def
_new_future
(
self
,
*
args
,
**
kwargs
):
r
eturn
self
.
cls
(
*
args
,
**
kwargs
)
def
setUp
(
self
):
super
().
setUp
()
...
...
@@ -147,6 +147,39 @@ class BaseFutureTests:
# Make sure Future doesn't accept a positional argument
self
.
assertRaises
(
TypeError
,
self
.
_new_future
,
42
)
def
test_uninitialized
(
self
):
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
self
.
assertRaises
(
asyncio
.
InvalidStateError
,
fut
.
result
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
self
.
assertRaises
(
asyncio
.
InvalidStateError
,
fut
.
exception
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
set_result
(
None
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
set_exception
(
Exception
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
cancel
()
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
add_done_callback
(
lambda
f
:
None
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
remove_done_callback
(
lambda
f
:
None
)
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
with
self
.
assertRaises
((
RuntimeError
,
AttributeError
)):
fut
.
_schedule_callbacks
()
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
try
:
repr
(
fut
)
except
AttributeError
:
pass
fut
=
self
.
cls
.
__new__
(
self
.
cls
,
loop
=
self
.
loop
)
fut
.
cancelled
()
fut
.
done
()
iter
(
fut
)
def
test_cancel
(
self
):
f
=
self
.
_new_future
(
loop
=
self
.
loop
)
self
.
assertTrue
(
f
.
cancel
())
...
...
@@ -501,15 +534,11 @@ class BaseFutureTests:
@
unittest
.
skipUnless
(
hasattr
(
futures
,
'_CFuture'
),
'requires the C _asyncio module'
)
class
CFutureTests
(
BaseFutureTests
,
test_utils
.
TestCase
):
def
_new_future
(
self
,
*
args
,
**
kwargs
):
return
futures
.
_CFuture
(
*
args
,
**
kwargs
)
cls
=
getattr
(
futures
,
'_CFuture'
)
class
PyFutureTests
(
BaseFutureTests
,
test_utils
.
TestCase
):
def
_new_future
(
self
,
*
args
,
**
kwargs
):
return
futures
.
_PyFuture
(
*
args
,
**
kwargs
)
cls
=
futures
.
_PyFuture
class
BaseFutureDoneCallbackTests
():
...
...
Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst
0 → 100644
View file @
bca4939d
Fixed miscellaneous errors in asyncio speedup module.
Modules/_asynciomodule.c
View file @
bca4939d
This diff is collapsed.
Click to expand it.
Modules/clinic/_asynciomodule.c.h
View file @
bca4939d
...
...
@@ -28,7 +28,7 @@ _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs)
int
return_value
=
-
1
;
static
const
char
*
const
_keywords
[]
=
{
"loop"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"|$O:Future"
,
_keywords
,
0
};
PyObject
*
loop
=
NULL
;
PyObject
*
loop
=
Py_None
;
if
(
!
_PyArg_ParseTupleAndKeywordsFast
(
args
,
kwargs
,
&
_parser
,
&
loop
))
{
...
...
@@ -244,7 +244,7 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs)
static
const
char
*
const
_keywords
[]
=
{
"coro"
,
"loop"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"O|$O:Task"
,
_keywords
,
0
};
PyObject
*
coro
;
PyObject
*
loop
=
NULL
;
PyObject
*
loop
=
Py_None
;
if
(
!
_PyArg_ParseTupleAndKeywordsFast
(
args
,
kwargs
,
&
_parser
,
&
coro
,
&
loop
))
{
...
...
@@ -477,7 +477,7 @@ _asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *
PyObject
*
return_value
=
NULL
;
static
const
char
*
const
_keywords
[]
=
{
"exc"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"|O:_step"
,
_keywords
,
0
};
PyObject
*
exc
=
NULL
;
PyObject
*
exc
=
Py_None
;
if
(
!
_PyArg_ParseStackAndKeywords
(
args
,
nargs
,
kwnames
,
&
_parser
,
&
exc
))
{
...
...
@@ -517,4 +517,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject
exit:
return
return_value
;
}
/*[clinic end generated code: output=
fe651840e0466fa9
input=a9049054013a1b77]*/
/*[clinic end generated code: output=
b92f9cd2b9fb37ef
input=a9049054013a1b77]*/
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