Index: gobject/pygtype.c
===================================================================
--- gobject/pygtype.c	(revision 1061)
+++ gobject/pygtype.c	(working copy)
@@ -422,6 +422,16 @@
 		      g_type_name(enum_type),
 		      g_type_name(((PyGEnum *) obj)->gtype));
 	}
+    /* Dumb code duplication, but probably not worth it to have yet another macro. */
+    } else if (PyLong_Check(obj)) {
+	*val = PyLong_AsLong(obj);
+	res = 0;
+
+	if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) {
+	    g_warning("expected enumeration type %s, but got %s instead",
+		      g_type_name(enum_type),
+		      g_type_name(((PyGEnum *) obj)->gtype));
+	}
     } else if (_PyUnicode_Check(obj)) {
 	GEnumValue *info;
 	char *str = _PyUnicode_AsString(obj);
