Turn warning messages into Python warnings. (#9387)

This commit is contained in:
Jiaming Yuan
2023-07-15 07:46:43 +08:00
committed by GitHub
parent 04aff3af8e
commit 9da5050643
3 changed files with 16 additions and 16 deletions

View File

@@ -153,7 +153,11 @@ def _expect(expectations: Sequence[Type], got: Type) -> str:
def _log_callback(msg: bytes) -> None:
"""Redirect logs from native library into Python console"""
print(py_str(msg))
smsg = py_str(msg)
if smsg.find("WARNING:") != -1:
warnings.warn(smsg, UserWarning)
return
print(smsg)
def _get_log_callback_func() -> Callable: