Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: use context manager in detection_callback.py
If we don't use a context manager, then we can get the following error after a CTRL+C: Exception ignored in: <function BleakScannerWinRT.start.<locals>.<lambda> at 0x0000020C3A76EE80> Traceback (most recent call last): File "C:\Users\david\Documents\GitHub\bleak\bleak\backends\winrt\scanner.py", line 238, in <lambda> lambda s, e: event_loop.call_soon_threadsafe(self._received_handler, s, e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\david\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 840, in call_soon_threadsafe self._check_closed() File "C:\Users\david\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed
- Loading branch information