From d3f57baf2a9e5e26e2365313abd2890239b6572a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 2 Dec 2010 17:27:34 +0000 Subject: 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. --- _dbus_bindings/bytes.c | 1 + 1 file changed, 1 insertion(+) (limited to '_dbus_bindings/bytes.c') 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; -- cgit v1.2.1