forked from goodboy/tractor
Oof, fix walrus assign causes name-error edge case
Only warn log on a non-`trio` async lib when in the main thread to avoid a name error when in the non-`asyncio` non-main-thread case. => To cherry into the `.pause_from_sync()` feature branch.msg_codecs
parent
3ba46362a9
commit
25ffdedc06
tractor/devx
|
@ -190,11 +190,14 @@ class Lock:
|
|||
is_trio_main = (
|
||||
# TODO: since this is private, @oremanj says
|
||||
# we should just copy the impl for now..
|
||||
trio._util.is_main_thread()
|
||||
(is_main_thread := trio._util.is_main_thread())
|
||||
and
|
||||
(async_lib := sniffio.current_async_library()) == 'trio'
|
||||
)
|
||||
if not is_trio_main:
|
||||
if (
|
||||
not is_trio_main
|
||||
and is_main_thread
|
||||
):
|
||||
log.warning(
|
||||
f'Current async-lib detected by `sniffio`: {async_lib}\n'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue