Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
tornadoweb
Tornado
提交
b9e2da20
Tornado
项目概览
镜像
/
tornadoweb
/
Tornado
12 个月 前同步成功
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Tornado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b9e2da20
编写于
3月 18, 2018
作者:
B
Ben Darnell
提交者:
GitHub
3月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2318 from bdarnell/concurrent-deprecation
concurrent: Add deprecation warning
上级
f98d06dd
eecf05f0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
33 addition
and
20 deletion
+33
-20
tornado/concurrent.py
tornado/concurrent.py
+8
-0
tornado/escape.py
tornado/escape.py
+13
-13
tornado/netutil.py
tornado/netutil.py
+4
-0
tornado/test/netutil_test.py
tornado/test/netutil_test.py
+8
-7
未找到文件。
tornado/concurrent.py
浏览文件 @
b9e2da20
...
...
@@ -426,6 +426,12 @@ def run_on_executor(*args, **kwargs):
.. versionchanged:: 5.1
Returns a `.Future` compatible with ``await`` instead of a
`concurrent.futures.Future`.
.. deprecated:: 5.1
The ``callback`` argument is deprecated and will be removed in
6.0. The decorator itself is discouraged in new code but will
not be removed in 6.0.
"""
def
run_on_executor_decorator
(
fn
):
executor
=
kwargs
.
get
(
"executor"
,
"executor"
)
...
...
@@ -437,6 +443,8 @@ def run_on_executor(*args, **kwargs):
conc_future
=
getattr
(
self
,
executor
).
submit
(
fn
,
self
,
*
args
,
**
kwargs
)
chain_future
(
conc_future
,
async_future
)
if
callback
:
warnings
.
warn
(
"callback arguments are deprecated, use the returned Future instead"
,
DeprecationWarning
)
from
tornado.ioloop
import
IOLoop
IOLoop
.
current
().
add_future
(
async_future
,
lambda
future
:
callback
(
future
.
result
()))
...
...
tornado/escape.py
浏览文件 @
b9e2da20
tornado/netutil.py
浏览文件 @
b9e2da20
...
...
@@ -328,6 +328,10 @@ class Resolver(Configurable):
.. versionchanged:: 4.4
Standardized all implementations to raise `IOError`.
.. deprecated:: 5.1
The ``callback`` argument is deprecated and will be removed in 6.0.
Use the returned awaitable object instead.
"""
raise
NotImplementedError
()
...
...
tornado/test/netutil_test.py
浏览文件 @
b9e2da20
...
...
@@ -13,7 +13,7 @@ from tornado.netutil import (
)
from
tornado.stack_context
import
ExceptionStackContext
from
tornado.testing
import
AsyncTestCase
,
gen_test
,
bind_unused_port
from
tornado.test.util
import
unittest
,
skipIfNoNetwork
from
tornado.test.util
import
unittest
,
skipIfNoNetwork
,
ignore_deprecation
try
:
from
concurrent
import
futures
...
...
@@ -38,6 +38,7 @@ else:
class
_ResolverTestMixin
(
object
):
def
test_localhost
(
self
):
with
ignore_deprecation
():
self
.
resolver
.
resolve
(
'localhost'
,
80
,
callback
=
self
.
stop
)
result
=
self
.
wait
()
self
.
assertIn
((
socket
.
AF_INET
,
(
'127.0.0.1'
,
80
)),
result
)
...
...
@@ -59,6 +60,7 @@ class _ResolverErrorTestMixin(object):
return
True
# Halt propagation.
with
ExceptionStackContext
(
handler
):
with
ignore_deprecation
():
self
.
resolver
.
resolve
(
'an invalid domain'
,
80
,
callback
=
self
.
stop
)
result
=
self
.
wait
()
...
...
@@ -108,13 +110,12 @@ class OverrideResolverTest(AsyncTestCase, _ResolverTestMixin):
}
self
.
resolver
=
OverrideResolver
(
BlockingResolver
(),
mapping
)
@
gen_test
def
test_resolve_multiaddr
(
self
):
self
.
resolver
.
resolve
(
'google.com'
,
80
,
socket
.
AF_INET
,
callback
=
self
.
stop
)
result
=
self
.
wait
()
result
=
yield
self
.
resolver
.
resolve
(
'google.com'
,
80
,
socket
.
AF_INET
)
self
.
assertIn
((
socket
.
AF_INET
,
(
'1.2.3.4'
,
80
)),
result
)
self
.
resolver
.
resolve
(
'google.com'
,
80
,
socket
.
AF_INET6
,
callback
=
self
.
stop
)
result
=
self
.
wait
()
result
=
yield
self
.
resolver
.
resolve
(
'google.com'
,
80
,
socket
.
AF_INET6
)
self
.
assertIn
((
socket
.
AF_INET6
,
(
'2a02:6b8:7c:40c:c51e:495f:e23a:3'
,
80
,
0
,
0
)),
result
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录