Closed gormanb closed 9 months ago
@KJonline: The unasync rule for pyhiveapi/api
is to ensure that the existing additional_replacements
are maintained unchanged for that directory. unasync
unfortunately doesn't appear to allow replacements at any granularity other than per-directory, nor does it allow replacing tokens like asyncio.Lock
, but it does allow you to overrule the replacements specified on higher-level directories with rules for their subdirectories.
So the first rule now says "change apyhiveapi
to pyhiveapi
and asyncio
to threading
everywhere," while the second rule says "except in pyhiveapi/api
, where we do not apply the asyncio
> threading
replacement." The result is that the only place where asyncio
is changed to threading
is in session.py
. Aside from that, the process produces exactly the same output as before.
This patch addresses the issue described in #74. When
pyhiveapi
is packaged viaunasync
, it removes theawait
from thisasyncio.Lock
acquisition inHiveSession.updateData
but otherwise leaves theasyncio.Lock
in place. As a result, callingupdateData
generates the following warning:... and can throw the following exception if it attempts to release the lock without having acquired it:
This patch adds an
unasync
rule to convert theasyncio.Lock
insession.py
tothreading.Lock
instead. No other code is affected by this change.