diff --git a/poetry.lock b/poetry.lock index 54e12ab..aa6cba6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -12,21 +12,6 @@ files = [ {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, ] -[[package]] -name = "async-timeout" -version = "4.0.2" -description = "Timeout context manager for asyncio programs" -category = "main" -optional = false -python-versions = ">=3.6" -files = [ - {file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"}, - {file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"}, -] - -[package.dependencies] -typing-extensions = {version = ">=3.6.5", markers = "python_version < \"3.8\""} - [[package]] name = "babel" version = "2.12.1" @@ -994,7 +979,7 @@ files = [ name = "typing-extensions" version = "4.5.0" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1038,4 +1023,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "efe6bba7d1d4270ef6646994cdb335ff93e9394bd8046121834b21e88302374b" +content-hash = "b66b41484e96b04db380a0821db014a05ecf99c4be505734c5cbbd4f8955c688" diff --git a/pyproject.toml b/pyproject.toml index c1b727c..41ca987 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ script = "build_ext.py" [tool.poetry.dependencies] python = "^3.7" -async-timeout = {version = ">=3.0.0", python = "<3.11"} # duplicated in docs/requirements.txt for readthedocs compatibility [tool.poetry.group.docs.dependencies] diff --git a/src/dbus_fast/aio/message_bus.py b/src/dbus_fast/aio/message_bus.py index 03634da..4d07ab7 100644 --- a/src/dbus_fast/aio/message_bus.py +++ b/src/dbus_fast/aio/message_bus.py @@ -2,16 +2,10 @@ import array import asyncio import logging import socket -import sys from collections import deque from copy import copy from typing import Any, Optional -if sys.version_info[:2] < (3, 11): - from async_timeout import timeout as asyncio_timeout -else: - from asyncio import timeout as asyncio_timeout - from .. import introspection as intr from ..auth import Authenticator, AuthExternal from ..constants import ( @@ -273,8 +267,13 @@ class MessageBus(BaseMessageBus): super().introspect(bus_name, path, reply_handler) - async with asyncio_timeout(timeout): + timer_handle = self._loop.call_later( + timeout, _future_set_exception, future, asyncio.TimeoutError + ) + try: return await future + finally: + timer_handle.cancel() async def request_name( self, name: str, flags: NameFlag = NameFlag.NONE