To answer your question:
What will happen if...
In the case where p1y == p2y and p1x != p2x
you will get a NameError
. You should initialise e.g.
xints = None
then test that it has been set to something sensible:
if p1x == p2x or (xints is not None and x <= xints):