diff options
author | Sam James <sam@gentoo.org> | 2022-06-01 08:20:25 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-06-01 08:25:35 +0100 |
commit | d173a3f19dec579437be5f5dd139339c22404a8e (patch) | |
tree | d2d9ada5b0d3b2a2940899ed6ab44b57d12c64ac /dev-python/dbus-next | |
parent | dev-python/starlette: enable py3.11 (diff) | |
download | gentoo-d173a3f19dec579437be5f5dd139339c22404a8e.tar.gz gentoo-d173a3f19dec579437be5f5dd139339c22404a8e.tar.bz2 gentoo-d173a3f19dec579437be5f5dd139339c22404a8e.zip |
dev-python/dbus-next: fix test crash w/ Python 3.11
Not yet adding Python 3.11 support though as I get another failure.
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/dbus-next')
-rw-r--r-- | dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild | 46 | ||||
-rw-r--r-- | dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch | 33 |
2 files changed, 79 insertions, 0 deletions
diff --git a/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild b/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild new file mode 100644 index 000000000000..7826aedf1dc8 --- /dev/null +++ b/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) +inherit distutils-r1 virtualx + +DESCRIPTION="The next great DBus library for Python with asyncio support" +HOMEPAGE="https://python-dbus-next.readthedocs.io/en/latest/" +SRC_URI="https://github.com/altdesktop/python-dbus-next/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}"/python-${P} + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +BDEPEND="test? ( + dev-python/pygobject[${PYTHON_USEDEP}] + dev-python/pytest-asyncio[${PYTHON_USEDEP}] + dev-python/pytest-timeout[${PYTHON_USEDEP}] + )" + +PATCHES=( + "${FILESDIR}"/${PN}-0.2.3-glib-crash.patch +) + +EPYTEST_IGNORE=( + # "interface not found on this object: org.freedesktop.DBus.Debug.Stats" + # Seems like we build dbus w/o this? + test/client/test_signals.py +) + +distutils_enable_tests pytest + +src_test() { + local dbus_params=( + $(dbus-daemon --session --print-address --fork --print-pid) + ) + local -x DBUS_SESSION_BUS_ADDRESS=${dbus_params[0]} + + virtx distutils-r1_src_test + + kill "${dbus_params[1]}" || die +} diff --git a/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch b/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch new file mode 100644 index 000000000000..714d733f3689 --- /dev/null +++ b/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch @@ -0,0 +1,33 @@ +https://github.com/altdesktop/python-dbus-next/pull/114 +https://github.com/altdesktop/python-dbus-next/issues/113 +https://gitlab.gnome.org/GNOME/pygobject/-/issues/525 + +From 445bc2cd0df80e36154e45ea3c4f268b550890b5 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <peter.hutterer@who-t.net> +Date: Tue, 22 Mar 2022 22:11:01 +1000 +Subject: [PATCH] glib: destroy the _AuthLineSource explicitly + +See https://gitlab.gnome.org/GNOME/pygobject/-/issues/525 for an +explanation, the summary is: we need to explicitly call source.destroy() +if dispatch returns GLib.SOURCE_REMOVE. + +Deleting the source by resetting it to None causes invalid memory +accesses and eventual crashes. + +This can be reproduced with a basic call to + bus = dbus_next.glib.MessageBus(bus_type=dbus_next.BusType.SESSION).connect_sync() +and a GLib.MainLoop() after this call. Run in valgrind --tool=memcheck. + +Fixes #113 +--- a/dbus_next/glib/message_bus.py ++++ b/dbus_next/glib/message_bus.py +@@ -457,7 +457,7 @@ def line_notify(line): + self._stream.write(Authenticator._format_line(resp)) + self._stream.flush() + if resp == 'BEGIN': +- self._readline_source = None ++ self._readline_source.destroy() + authenticate_notify(None) + return True + except Exception as e: + |