Commits

João Poupino  committed f0173e0 Draft
  • Participants
  • Parent commits 3ae8ec1

Comments (0)

Files changed (1)

File inotify/_inotify.c

 		goto bail;
 
 	if (evt->name != Py_None) {
+		PyObject *pyname = PyObject_Repr(evt->name);
+
 		if (cookie == 0)
-			ret = PyUnicode_FromFormat("event(wd=%d, mask=%U, name=%U)",
-										wd, pymask, evt->name);
+			ret = PyUnicode_FromFormat("event(wd=%d, mask=%U, name=%V)",
+										wd, pymask, pyname, "???");
 		else
 			ret = PyUnicode_FromFormat("event(wd=%d, mask=%U, "
-										"cookie=0x%x, name=%U)",
-									wd, pymask, cookie, evt->name);
+										"cookie=0x%x, name=%V)",
+									wd, pymask, cookie, pyname, "???");
 
+		Py_XDECREF(pyname);
 	} else {
 		if (cookie == 0)
 			ret = PyUnicode_FromFormat("event(wd=%d, mask=%U)",
 			Py_INCREF(Py_None);
 			evt->cookie = Py_None;
 		}
-
-		evt->name = in->len ? PyUnicode_FromString(in->name) : NULL;
-		if (evt->name == NULL) {
+		if (in->len)
+			evt->name = PyUnicode_FromString(in->name);
+		else {
 			Py_INCREF(Py_None);
 			evt->name = Py_None;
 		}