https://gitlab.gnome.org/GNOME/pygobject/-/commit/07cb8d7dfc2f

--- gi/pygobject-object.c.orig	2018-05-31 14:39:04 UTC
+++ gi/pygobject-object.c
@@ -846,7 +846,10 @@ pygobject_inherit_slots(PyTypeObject *type, PyObject *
                                   offsetof(PyTypeObject, tp_iter),
                                   offsetof(PyTypeObject, tp_repr),
                                   offsetof(PyTypeObject, tp_str),
-                                  offsetof(PyTypeObject, tp_print) };
+#if PY_VERSION_HEX < 0x03000000
+                                  offsetof(PyTypeObject, tp_print),
+#endif
+    };
     gsize i;
 
     /* Happens when registering gobject.GObject itself, at least. */
