ENH: improve new where function

Allow object and zerosized iteration and move bool casting of mask into
the iterator logic and improve tests appropriately.