- Package:
- src:dbus-python
- Source:
- src:dbus-python
- Submitter:
- Maximiliano Curia
- Date:
- 2026-09-27 17:21:03 UTC
- Severity:
- normal
- Tags:
Package: src:dbus-python
Version: 1.4.0-1
User: debian-python@lists.debian.org
Usertags: python3.15
Hi!
While rebuilding packages against Python 3.15 we found that dbus-python
failed to build from source due to failing tests. All the tests were
saying something like:
test: dbus-python:standalone
start time: 10:20:31
duration: 0.05s
result: exit status 1
command: DBUS_TEST_TMPDIR=/build/reproducible-path/dbus-python-1.4.0/build-3.15/test DBUS_TOP_SRCDIR=/build/reproducible-path/dbus-python-1.4.0 DBUS_PYTHON_VERSION=1.4.0 MALLOC_PERTURB_=171 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 PYTHONPATH=/build/reproducible-path/dbus-python-1.4.0:/build/reproducible-path/dbus-python-1.4.0/test:/build/reproducible-path/dbus-python-1.4.0/build-3.15:/build/reproducible-path/dbus-python-1.4.0/build-3.15/test MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 DBUS_TEST_UNINSTALLED=1 DBUS_FATAL_WARNINGS=1 MESON_TEST_ITERATION=1 DBUS_TOP_BUILDDIR=/build/reproducible-path/dbus-python-1.4.0/build-3.15 /usr/bin/dbus-run-session --config-file /build/reproducible-path/dbus-python-1.4.0/build-3.15/test/tmp-session-bus.conf -- /usr/bin/python3.15 /build/reproducible-path/dbus-python-1.4.0/build-3.15/../test/test-standalone.py
----------------------------------- stderr -----------------------------------
Traceback (most recent call last):
File "/build/reproducible-path/dbus-python-1.4.0/build-3.15/../test/test-standalone.py", line 39, in <module>
import _dbus_bindings
SystemError: type _dbus_bindings.Connection has the Py_TPFLAGS_MANAGED_WEAKREF flag but not Py_TPFLAGS_HAVE_GC flag
The problem seems to be caused by the fact that the Connection is a
GenericAlloc that's missing the PyGC_Head header header, this is now detected in
Python 3.15 (see: https://github.com/python/cpython/issues/134786).
The weakref was introduced by ebecd174 but the previous mechanism still
works, so I'm reverting ebecd174 and adding a regression test that
should fail in python 3.12 to 3.14.
Happy hacking,
Control: forwarded -1 https://gitlab.freedesktop.org/dbus/dbus-python/-/work_items/59
I'd prefer to address this upstream rather than as a Debian-specific
patch (see also: the forwarded report above).
Would this revert be considered (by Python upstream) to be a correct
solution, or a workaround, or what? Is there a porting guide available
that would clarify what the most appropriate change is?
ebecd174 was an attempt to follow what, at the time, I believed was
upstream best-practice. Perhaps I was wrong about that, or perhaps
best-practice has changed - but I'd prefer to know which is applicable.
Thanks,
smcv
¡Hola Simon!
El 2026-08-16 a las 15:14 +0100, Simon McVittie escribió:
I've been getting 504 Gateway Time-out errors from
gitlab.freedesktop.org, I could not clone the repository nor access
upsteam issue tracker.
Update, while checking the code the page finally could be loaded, it
would have been very useful to be able the access this issue prior
patching the code. :)
I'll try to send a version of this conversation upstream, if I manage to
create a user in the gitlab instance before another 504.
The issue with the way the weakref is handled in now detected as an
error, but it was trying to access an invalid memory before (see the
regression test, you can test it against 3.12, 3.13 or 3.14 and it
produces a segfault). The issue has to do with how the weak refs are
implemented in python, which basically uses the struct reserved for he
gc, which the connection and server objects don't have.
To have working weakrefs for connection and server, needs a bit of
tweaking of the parts.
So, the error actually says (a part of) how to solve it
'_dbus_bindings.Connection has the Py_TPFLAGS_MANAGED_WEAKREF flag but
not Py_TPFLAGS_HAVE_GC flag', that is in DBusPyConnection_Type (conn.c),
you'll need to add the flag Py_TPFLAGS_HAVE_GC:
#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0)
Py_TPFLAGS_MANAGED_WEAKREF | Py_TPFLAGS_HAVE_GC |
#endif
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
The same for DBusPyServer_Type.
But then you also need to write the corresponding traverse functions
(currently they are NULL) probably using Py_VISIT on the subelements
that can hold a python object, handle the GC on dealloc.
Well, I don't have as much context as you have about this project, I
think that you wanted a weakref to avoid an unclaimable reference
cycle, if that's the case, then the revert is going to bring that back.
So probably finishing the weakref patch would be a better approach (the
regression test I included in the patch should still be useful for
that).
Happy hacking,
Hi, While rebuilding other packages, I found that my proposed patch breaks python-dbusmock [1]. My understanding is that adding the proper garbage collection has triggered an underlying bug: when a connection is getting unregistered, there might be more than one call to _object_path_unregister, which causes the second call to trigger an error. I have worked around this issue by adding a handler for the specific exception raised by DBusPyConnection_ExistingFromDBusConnection in this case inside the _object_path_unregister. With this change applied, python-dbusmock builds successfully. I have also updated my upstream PR with the same fix. Please consider reviewing the patch upstream and fixing the package to support the upcoming Python 3.15 migration. Thanks! [1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4473020/
We believe that the bug you reported is fixed in the latest version of
dbus-python, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1144533@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Simon McVittie <smcv@debian.org> (supplier of updated dbus-python package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 27 Sep 2026 17:58:26 +0100
Source: dbus-python
Architecture: source
Version: 1.5.0-1
Distribution: unstable
Urgency: medium
Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Changed-By: Simon McVittie <smcv@debian.org>
Closes: 1039499 1144533
Changes:
dbus-python (1.5.0-1) unstable; urgency=medium
.
* New upstream release
- Works on Python 3.15 (Closes: #1144533)
* Build with pybuild and mesonpy
* d/control: Use debhelper compat level 14
- Remove substvars that are now added automatically
* d/control: Remove Rules-Requires-Root: no, default since Debian 13
* d/control: Standards-Version: 4.7.4
- No longer needs Priority: optional
* d/control: python3-dbus-tests Recommends python3-tap (Closes: #1039499)
* d/control, d/tests/control: Normalize formatting (debputy reformat)
* d/upstream/metadata: Update Gitlab issue tracker URLs
* d/watch: Update to v5 format
* d/watch: Look for any supported archive extension, not just .tar.gz
* d/watch: Also look for PEP-0625 name dbus_python-*.tar.*
* Update lintian overrides
* Remove files associated with binary packages that are no longer built
* d/upstream/signing-key.asc: Update subkeys
* d/copyright: Update
* d/copyright: Don't quote the FSF's postal address here
* d/gbp.conf: Merge upstream VCS tags
Checksums-Sha1:
2b76214df44c9e1d56af30c59eacdb95e843b6fb 3334 dbus-python_1.5.0-1.dsc
486069433ec5ba462abfe88af5e1046bda126b0f 203989 dbus-python_1.5.0.orig.tar.gz
10520c0e3f9b8b4a37d82823b5d7bd20a6aedb71 833 dbus-python_1.5.0.orig.tar.gz.asc
475b20ee834a5112186994d5642fa6df3fc15e31 30404 dbus-python_1.5.0-1.debian.tar.xz
101999ffc46b8a7c74b6820e0775f3a1a9497081 421776 dbus-python_1.5.0-1.git.tar.xz
a69c6e22797a0daf879fb51143e4dc3a6d63e773 17740 dbus-python_1.5.0-1_source.buildinfo
Checksums-Sha256:
1669a2bdc67e30aba488134ca96ee0265831deef0277a73e8b7fa5d273ca7949 3334 dbus-python_1.5.0-1.dsc
ac94ce330879108e5d37105164cc14b595bdf9326d2ce4a5acad6c1ab2bf6476 203989 dbus-python_1.5.0.orig.tar.gz
a7dac5ffac4eca1224e7c8f7f417d7a36b797229974468030a23e5e684c51803 833 dbus-python_1.5.0.orig.tar.gz.asc
20d8a259f21a95c35c2fe79527f93b5772b09138879eebb8b1b53dfdcc4f5814 30404 dbus-python_1.5.0-1.debian.tar.xz
e4f209935165854194c4f5af732ecc03cba10f5f8e59c95638afbae937a1bc44 421776 dbus-python_1.5.0-1.git.tar.xz
e316bbca838beb58fb91d94a6018c14e5980b824356b43890ca4ab4c71e2f68f 17740 dbus-python_1.5.0-1_source.buildinfo
Files:
4044056a9933a3fc3c94b1b6c1aeaaa0 3334 devel optional dbus-python_1.5.0-1.dsc
6c2b06c6c0d2bfd5a03c3fafafedcf09 203989 devel optional dbus-python_1.5.0.orig.tar.gz
b79beaaff872c0441f21372f56878139 833 devel optional dbus-python_1.5.0.orig.tar.gz.asc
5b32bee7420ab11ade377831a66f29e4 30404 devel optional dbus-python_1.5.0-1.debian.tar.xz
1763c7ccf02d0216af68b1bd7219842d 421776 devel None dbus-python_1.5.0-1.git.tar.xz
8060cf6c9d1592613758821435358bec 17740 devel optional dbus-python_1.5.0-1_source.buildinfo
Git-Tag-Info: tag=1a87fdd4d969eefd8921f4589611c768f7eaf752 fp=7a073ad1ae694fa25bff62e5235c099d3eb33076
Git-Tag-Tagger: Simon McVittie <smcv@debian.org>
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEN02M5NuW6cvUwJcqYG0ITkaDwHkFAmq5THIACgkQYG0ITkaD
wHmU8A/+Km6okBtHTzig9dGG5doAKrVgxazCg3UwA/03Z9fHsdxz9Ibqfz1+pwSu
u7ImZdBfS7NTmP7deKN1EGgMUwtpLqOSuvhKvt5lkeCLzB7NyvKeMzDtH4cCwV/K
ndN89ddDONsVQ+EPNVAtQOfQrYT4QtbKWAYqdLYNzy0DGEN3VmnagkAtSrWakZ06
CxCpxItc5GGrg6iVSA9XKsM8w0ZbE/Mbg/vLCjG2gJdLR7ocK7QYUL2l1+gbAYVp
ccSX9+patff/koeYfNxrcr3lgzs/OIScu2mg6Z4l1H2abQVo/X9Asv+R0ro2Kgxf
6gU1xyiMbYbq4R+M9SknoCWxCqjLwaidGX56BIQrjDADMNbUjvwfneQ9xQFo43uN
RDUW2S9wuPj58HYI3TiQ/TuVAxi9dfnhIkMQVTp7vbo5mqOG/Ehsk5/bGSaHPgLy
FthjGhEX91BEePh+LU01hwKPPubbPC3NdeP/7FRjZ8Sm6OXhpKlpWeq7XOZCiDBu
8bOSKJ84oEDf/z5cl6paPd377/66UYvo1yNHfw5v7Fc6tjSjIgqCY6yPWf6DXgGg
HQd9ngb9EZsQA574HMOaMYoRUCAkx6p2JJJnJJjLniKAgwkLg07JclQXn8HQ2lZP
byzq4VrHcgS+1gdrebxlg3i/JvIaPMxv33Jc4KWxVQZ7yQKTVGU=
=w3Zb
-----END PGP SIGNATURE-----