Skip to content

Commit

Permalink
backends/bluezdbus: don't import dbus_next directly
Browse files Browse the repository at this point in the history
The top-level dbus_next module tries to import the GLib backend that is
not used by Bleak. This wastes memory and can cause a crash if the
available version of `gi` is not compatible.

Fixes: #1412
  • Loading branch information
dlech committed Sep 4, 2023
1 parent a377ce6 commit 37f1a91
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
`Unreleased`_
=============

Fixed
-----
- Fixed importing unnecessary ``gi`` import in BlueZ backend. Fixes #1412.


`0.21.0`_ (2023-09-02)
======================

Expand Down
4 changes: 3 additions & 1 deletion bleak/backends/bluezdbus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
)
from weakref import WeakKeyDictionary

from dbus_fast import BusType, Message, MessageType, Variant, unpack_variants
from dbus_fast.constants import BusType, MessageType
from dbus_fast.service import Message, Variant
from dbus_fast.unpack import unpack_variants
from dbus_fast.aio.message_bus import MessageBus

from ...exc import BleakDBusError, BleakError
Expand Down
2 changes: 1 addition & 1 deletion bleak/backends/bluezdbus/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Callable, Coroutine, Dict, List, Literal, Optional, TypedDict
from warnings import warn

from dbus_fast import Variant
from dbus_fast.service import Variant

from ...exc import BleakError
from ..scanner import AdvertisementData, AdvertisementDataCallback, BaseBleakScanner
Expand Down

0 comments on commit 37f1a91

Please sign in to comment.