@@ -256,14 +256,14 @@ def syncify(
256
256
By default this is expected to be used from a worker thread. For example inside
257
257
some function passed to `asyncify()`.
258
258
259
- But if you set `check_called_from_async ` to `False`, you can also use this function
259
+ But if you set `raise_sync_error ` to `False`, you can also use this function
260
260
in a non-async context: without an async event loop. For example, from a
261
261
blocking/regular function called at the top level of a Python file. In that case,
262
262
if it is not being called from inside a worker thread started from an async context
263
263
(e.g. this is not called from a function that was called with `asyncify()`) it will
264
264
run `async_function` in a new async event loop with `anyio.run()`.
265
265
266
- This functionality with `check_called_from_async ` is there only to allow using
266
+ This functionality with `raise_sync_error ` is there only to allow using
267
267
`syncify()` in codebases that are used by async code in some cases and by blocking
268
268
code in others. For example, during migrations from blocking code to async code.
269
269
@@ -285,7 +285,9 @@ async def do_work(arg1, arg2, kwarg1="", kwarg2=""):
285
285
286
286
`async_function`: an async function to be called in the main thread, in the async
287
287
event loop
288
- `check_called_from_async`: If set to `False`
288
+ `raise_sync_error`: If set to `False`, when used in a non-async context (without
289
+ an async event loop), it will run `async_function` in a new async event loop,
290
+ instead of raising an exception.
289
291
290
292
## Return
291
293
0 commit comments