summaryrefslogtreecommitdiff
path: root/_dbus_bindings/bytes.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-12-02 17:27:34 +0000
committerSimon McVittie <smcv@debian.org>2010-12-02 17:27:34 +0000
commitd3f57baf2a9e5e26e2365313abd2890239b6572a (patch)
treeaf069da129d5b0d17f9dcb294cedc8bd1a607002 /_dbus_bindings/bytes.c
parent56ad64cd14e52b479489549f76343f19e3842139 (diff)
downloaddbus-python-d3f57baf2a9e5e26e2365313abd2890239b6572a.tar.gz
fd.o #23831: make sure to ref types passed to PyModule_AddObject
This avoids these static types wrongly being deallocated. Python implements static types as having one initial reference, which is never meant to be released, but if you get your refcounting wrong they'll be "deallocated" (causing a crash) during Py_Finalize.
Diffstat (limited to '_dbus_bindings/bytes.c')
-rw-r--r--_dbus_bindings/bytes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/_dbus_bindings/bytes.c b/_dbus_bindings/bytes.c
index bc12a14..5c76ec2 100644
--- a/_dbus_bindings/bytes.c
+++ b/_dbus_bindings/bytes.c
@@ -252,6 +252,7 @@ dbus_py_init_byte_types(void)
dbus_bool_t
dbus_py_insert_byte_types(PyObject *this_module)
{
+ /* PyModule_AddObject steals a ref */
Py_INCREF(&DBusPyByte_Type);
if (PyModule_AddObject(this_module, "Byte",
(PyObject *)&DBusPyByte_Type) < 0) return 0;