The question: in order to apply the argument principle to a function, does it need to be meromorphic everywhere, or only on and within the contour?
Take for example a function of the form $g(x)=\sin(\frac{π f(x)}{x})$. If the contour itself does not cross, or encircle $x=0$, then can we use the Cauchy argument principle?
If $U$ is a complex region that is some distance away from $0$ (or more generally, all of the essential singularities), then $g$ is meromorphic on $U$. The definition of meromorphic doesn't require globally meromorphic extensions. Just follow the definitions and everything will work out fine.