bpo-32436: Document PEP 567 changes to asyncio. (GH-7073) · python/cpython@2fc443c (original) (raw)

`` @@ -124,7 +124,7 @@ keywords to your callback, use :func:functools.partial. For example,

``

124

124

``` parameters in debug mode, whereas lambda functions have a poor

```

125

125

` representation.

`

126

126

``

127

``

`-

.. method:: AbstractEventLoop.call_soon(callback, *args)

`

``

127

`+

.. method:: AbstractEventLoop.call_soon(callback, *args, context=None)

`

128

128

``

129

129

` Arrange for a callback to be called as soon as possible. The callback is

`

130

130

`` called after :meth:call_soon returns, when control returns to the event

``

`` @@ -137,19 +137,31 @@ keywords to your callback, use :func:functools.partial. For example,

``

137

137

` Any positional arguments after the callback will be passed to the

`

138

138

` callback when it is called.

`

139

139

``

``

140

`+

An optional keyword-only context argument allows specifying a custom

`

``

141

`` +

:class:contextvars.Context for the callback to run in. The current

``

``

142

`+

context is used when no context is provided.

`

``

143

+

140

144

`` An instance of :class:asyncio.Handle is returned, which can be

``

141

145

` used to cancel the callback.

`

142

146

``

143

147

`` :ref:`Use functools.partial to pass keywords to the callback

``

144

148

`` `.

``

145

149

``

146

``

`-

.. method:: AbstractEventLoop.call_soon_threadsafe(callback, *args)

`

``

150

`+

.. versionchanged:: 3.7

`

``

151

`` +

The context keyword-only parameter was added. See :pep:567

``

``

152

`+

for more details.

`

``

153

+

``

154

`+

.. method:: AbstractEventLoop.call_soon_threadsafe(callback, *args, context=None)

`

147

155

``

148

156

`` Like :meth:call_soon, but thread safe.

``

149

157

``

150

158

`` See the :ref:concurrency and multithreading <asyncio-multithreading>

``

151

159

` section of the documentation.

`

152

160

``

``

161

`+

.. versionchanged:: 3.7

`

``

162

`` +

The context keyword-only parameter was added. See :pep:567

``

``

163

`+

for more details.

`

``

164

+

153

165

``

154

166

`.. _asyncio-delayed-calls:

`

155

167

``

`` @@ -166,7 +178,7 @@ a different clock than :func:time.time.

``

166

178

` Timeouts (relative delay or absolute when) should not exceed one day.

`

167

179

``

168

180

``

169

``

`-

.. method:: AbstractEventLoop.call_later(delay, callback, *args)

`

``

181

`+

.. method:: AbstractEventLoop.call_later(delay, callback, *args, context=None)

`

170

182

``

171

183

` Arrange for the callback to be called after the given delay

`

172

184

` seconds (either an int or float).

`

`` @@ -182,10 +194,18 @@ a different clock than :func:time.time.

``

182

194

` is called. If you want the callback to be called with some named

`

183

195

`` arguments, use a closure or :func:functools.partial.

``

184

196

``

``

197

`+

An optional keyword-only context argument allows specifying a custom

`

``

198

`` +

:class:contextvars.Context for the callback to run in. The current

``

``

199

`+

context is used when no context is provided.

`

``

200

+

185

201

`` :ref:`Use functools.partial to pass keywords to the callback

``

186

202

`` `.

``

187

203

``

188

``

`-

.. method:: AbstractEventLoop.call_at(when, callback, *args)

`

``

204

`+

.. versionchanged:: 3.7

`

``

205

`` +

The context keyword-only parameter was added. See :pep:567

``

``

206

`+

for more details.

`

``

207

+

``

208

`+

.. method:: AbstractEventLoop.call_at(when, callback, *args, context=None)

`

189

209

``

190

210

` Arrange for the callback to be called at the given absolute timestamp

`

191

211

` when (an int or float), using the same time reference as

`

`` @@ -199,6 +219,10 @@ a different clock than :func:time.time.

``

199

219

`` :ref:`Use functools.partial to pass keywords to the callback

``

200

220

`` `.

``

201

221

``

``

222

`+

.. versionchanged:: 3.7

`

``

223

`` +

The context keyword-only parameter was added. See :pep:567

``

``

224

`+

for more details.

`

``

225

+

202

226

`.. method:: AbstractEventLoop.time()

`

203

227

``

204

228

`` Return the current time, as a :class:float value, according to the

``