I went with
if (0 < i && i <= 256 && !lua_isnone(L, lua_upvalueindex(i))) { ... }
But is this even necessary? i originates from the third return value from the generator function, which starts at 0 and only increments from there. Additionally, MAXUPVAL is 255, so itervarargs cannot be called with a second argument greater than 255, which means that i cannot be greater than 256 in the first place. In short, i is already guaranteed to be between 1 and 256 inclusive, and therefore guaranteed to be an acceptable argument to lua_upvalueindex, in the first place.
So unless I'm missing something here (I admit my Lua/C API skills are rusty), the if condition can be reduced back to just the original !lua_isnone call.