What type of message "Exception ignored in" is?

As some have noted, not everyone always gets the behaviour that you describe. For instance, you won't get this behaviour at the REPL. To reproduce this behaviour on the REPL you have to add del gen at the end. This lets us know where the warning is coming. The warning is coming from the clean up function of the generator object, which has noticed that the generator has not exited cleanly.

What specifically has happened is that the generator has raised an exception whilst the interpreter is trying clean up the generator and release its resources. The interpreter has no way to propagate this exception back, so instead it logs this state and carries on. Specifically, PyErr_WriteUnraisable is is being called. And here is how it is being called (comments mine).

void
_PyGen_Finalize(PyObject *self)
{
    ...

    if (gen is a coroutine) {
        // special error detecting logic for coroutines
    }
    else {
        res = gen_close(gen, NULL); // <- raises GeneratorExit
    }

    if (res == NULL) {
        if (PyErr_Occurred()) {
            PyErr_WriteUnraisable(self);
        }
    }
    else {
        Py_DECREF(res);
    }

    ...
}