So a return type of 'void|object' means this function may return either an object or nothing at all. But if it returns nothing there won't be an error, because the missing value is converted to 0? Whereas if the return type were just 'object' and you returned nothing, the compiler would complain? Hope I've got that right, because that does make a lot more sense :)
That is correct. It would make no difference to the caller; the function could still be returning 0. But with a return type of just "object", the function needs to use "return 0;" to achieve this, rather than just "return;".
The difference is rather cosmetic; the caller has no way of knowing the function did "return;" or "return 0;", the value will be 0 in either case.
Though in that case, surely there's no point to SDL.get_video_info() returning type 'void|object', [...]
For functions implemented in C, it makes no practical difference whatsoever. So I guess the point (if any) is purely documentational. I don't know about this particular function, but if you have a function which conceptually, depending on what parameters you give it, either returns something or doesn't, then using this kind of return type could make sense, even though in reality the function will always return something. If the function conceptually returns either "an object" or "no object", as opposed to either "an object" or "nothing", then "object" is the better return type, since (object)0 is fine for "no object".