Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.19.2 #1116

Merged
merged 6 commits into from
Nov 6, 2022
Merged

Release/0.19.2 #1116

merged 6 commits into from
Nov 6, 2022

Commits on Nov 6, 2022

  1. winrt/client: fix crash when getting services

    Python 3.11 crashes on Windows when connecting to a device:
    
        Traceback (most recent call last):
        File "C:\Users\david\Documents\GitHub\Pybricks\bleak\examples\service_explorer.py", line 64, in <module>
            asyncio.run(main(sys.argv[1] if len(sys.argv) == 2 else ADDRESS))
        File "C:\Users\david\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
            return runner.run(main)
                ^^^^^^^^^^^^^^^^
        File "C:\Users\david\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
            return self._loop.run_until_complete(task)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\david\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
            return future.result()
                ^^^^^^^^^^^^^^^
        File "C:\Users\david\Documents\GitHub\Pybricks\bleak\examples\service_explorer.py", line 29, in main
            async with BleakClient(address) as client:
        File "C:\Users\david\Documents\GitHub\Pybricks\bleak\bleak\__init__.py", line 433, in __aenter__
            await self.connect()
        File "C:\Users\david\Documents\GitHub\Pybricks\bleak\bleak\__init__.py", line 471, in connect
            return await self._backend.connect(**kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            await self.get_services()
        File "C:\Users\david\Documents\GitHub\Pybricks\bleak\bleak\backends\winrt\client.py", line 574, in get_services
        File "C:\Users\david\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 418, in wait
            return await _wait(fs, timeout, return_when, loop)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\david\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 522, in _wait
            f.add_done_callback(_on_completion)
            ^^^^^^^^^^^^^^^^^^^
        AttributeError: '_bleak_winrt_Windows_Foundation.IAsyncOperation' object has no attribute 'add_done_callback'
    
    asyncio.wait() requires an asyncio.Task or asyncio.Future, but we were
    passing a WinRT IAsyncResult object. So we have to wrap it in a
    coroutine and then in a task to avoid the error.
    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    0231e38 View commit details
    Browse the repository at this point in the history
  2. winrt/client: change get services retry cache mode

    This changes the cache mode when getting services after a ServicesChanged
    event in the WinRT backend. This matches the recommendation of the docs.
    
    https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothledevice.gattserviceschanged?view=winrt-20348
    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    4a79290 View commit details
    Browse the repository at this point in the history
  3. winrt/client: add FutureLike wrapper for IAsyncOperation

    The fix from #1101 causes the following when run with `python3.10 -X dev`.
    
        ERROR:asyncio:Exception in callback Future.set_result(<Future cance...events.py:429>, <_bleak_winrt...001C33C60B100>)
        handle: <Handle Future.set_result(<Future cance...events.py:429>, <_bleak_winrt...001C33C60B100>)>
        Traceback (most recent call last):
        File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
            self._context.run(self._callback, *self._args)
        asyncio.exceptions.InvalidStateError: invalid state
        ERROR:asyncio:Exception in callback Future.set_result(<Future cance...events.py:429>, <_bleak_winrt...001C33C60BFC0>)
        handle: <Handle Future.set_result(<Future cance...events.py:429>, <_bleak_winrt...001C33C60BFC0>)>
        Traceback (most recent call last):
        File "C:\Users\david\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
            self._context.run(self._callback, *self._args)
        asyncio.exceptions.InvalidStateError: invalid state
    
    This adds a new FutureLike wrapper to make the IAsyncOperation object
    look like an asyncio.Future instead of wrapping it in a task.
    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    6189f27 View commit details
    Browse the repository at this point in the history
  4. winrt/client: fix logger.warn deprecation warning

    When run with python3.10 -dev X, we get a warning that warn is
    deprecated and we should replace it with warning.
    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    431cfc9 View commit details
    Browse the repository at this point in the history
  5. bluezdbus/manager: ignore KeyError when properties removed

    Apparently, BlueZ will sometimes request to remove properties that
    were not set in the first place.
    
    Fixes: #1107
    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    9c9dac6 View commit details
    Browse the repository at this point in the history
  6. v0.19.2

    dlech committed Nov 6, 2022
    Configuration menu
    Copy the full SHA
    4371cb4 View commit details
    Browse the repository at this point in the history