Commits

Simon Cross committed 612e34d

Work-around tp_getattro to allow event attributes to be looked up under PyPy.

  • Participants
  • Parent commits c2c14a0

Comments (0)

Files changed (1)

 }
 
 
+PyObject* PyEventObject_GenericGetAttr(PyObject *o, PyObject *name) {
+    PyObject* result;
+    result = PyObject_GenericGetAttr(o, name);
+    if (result)
+       return result;
+    PyErr_Clear();
+    result = PyDict_GetItem(((PyEventObject*) o)->dict, name);
+    if (!result)
+       PyErr_SetString(PyExc_AttributeError, "Attribute not found");
+    else
+       Py_INCREF(result);
+    return result;
+}
+
 static PyTypeObject PyEvent_Type =
 {
     TYPE_HEAD (NULL, 0)
     (hashfunc)NULL,                  /*hash*/
     (ternaryfunc)NULL,               /*call*/
     (reprfunc)NULL,                  /*str*/
-    PyObject_GenericGetAttr,         /* tp_getattro */
+    PyEventObject_GenericGetAttr,         /* tp_getattro */
     PyObject_GenericSetAttr,         /* tp_setattro */
     0,                               /* tp_as_buffer */
 #if PY3