I’m just picturing that robot from Star Trek (the one thinking about “this sentence is false”) going “huh” and then blowing up…
https://en.m.wikipedia.org/wiki/Sex-determining_region_Y_protein
More important (but still not all-deciding) than the XY phenotype is the presence or absence of SRY, which depending on mutations and faulty crossovers can be present on either X or Y